#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Node
{
    int data;
    struct Node* next;
}Node;
Node* createNode(int data)
{
    Node* newNode  (Node*)malloc(sizeof(Node));
    if(newNode == NULL){
        perror("Memory allocation failed");
        exit(EXIT_FAILURE);
    }
    newNode->data = data;
    newNode->next = NULL;
    return newNode;
}
void insertNode(Node** head, Node* newNode)
{
    if(newNode == NULL) return;
    if(*head == NULL)
    {
        *head = newNode;
        newNode->next = *head;
    }else{
        Node* current = *head;
        while (current->next != *head)
        {
            current = current->next;
        }
        current->next = newNode;
        newNode->next = *head;
    }
}
void printList(Node* head)
{
    if (head == NULL)
    {
        printf("\n");
        return;
    }
    Node* current = head;
    do{
        printf("%d", current->data);
        current = current->next;
        if(current != head)
        {
            printf(" ");
        }
    }while (current != head);
    printf("\n");
}
void freeList(Node* head){
    if (head)
}