#include<stdio.h>
#include<stdlib.h>

typedef struct Node {
    int data;
    struct Node* next;
} Node;

Node* createNode(int data){
    Node* newNode =(Node*)malloc(sizeof(Node));
    if(!newNode){
        printf("Memory error\n");
        return NULL;
    }
    
    newNode->data = data;
    newNode-> next =NULL;
    return newNode;
}

void insertNode(Node** head, int, int data){
    Node* newNode = createNode(data);
    if(*head == NULL){
        *head = newNode;
        return;
    }
    Node* last = *head;
    while(last->next){
        last = last->next;
    }
    last->next =