#include<stdio.h>
#include<stdlib.h>
struct Node { int data; struct Node*next;};
int main() {
    int n, x;
    scanf("%d",&n);
    if(n<0) { printf("Invalid input"); return 0;
    struct Node*head=NULL,*tall=NULL,*t;
    for(int i=0;i<n;i++) {
        scanf("%d",&x);
        t=malloc(sizeof(struct Node));
        t->data = x; t->next = NULL;
        if(!head) head =t;
        else tail-> =t;
        tail = t;
    }
    for(t=head;)
}