// editor3
#include<stdio.h>
#include<stdlib.h>
struct node
{
    int data;
    struct node*next;
};
struct node*createnode(int value){
    struct node*newnode = (struct node*)malloc(sizeof(struct node));
    newnode->node=value;
    newnode->next=NULL;
    retrun newnode;
}
void append(struct node**head,int value){
    struct node*newnode = createnode(value)
    if(*head ==  NULL){
        *head = newnode;
        return 0;
    }
    struct node*temp=*head;
    while(temp->next != NULL){
        temp = temp->next;
    }
    tepm->next=newnode;
}
void deletlast(struct node**head,int k){
    if(*head == NULL)
    return  0 ;
    
    int length = 0;
    struct node*temp = head;
    while(tepm!=NULL){
        length++;
        temp = temp->next;
    }
    struct node*del = temp->next;
    temp->next = NULL;
    while (del != NULL){
        struct node*nextm= del->next;
        free(del);
        del = next;
    }
    struct node*curr = *head;
    while (curr != NULL){
        printf("%d",curr->data);
        if(curr-next != NULL)
        printf("");
        curr = curr->next;
    }
    printf("\n");
}
int main()
{
    int n;
    if(scanf("%d",&n) !=1|| n<1 || n>1000){
        printf("Invalid input\n");
        return 0;
    }
    struct node*head = NULL;
    for (int i=0;i<n;i++){
        int value;
        if(scanf("%d",&value)!=1){
            printf("Invaild input\n");
            return 0;
        }
        apppend(&head,value);
    }
    int k;
    if(scanf("%d"&k)!=1 || k<0){
        printf("Invalid input\n");
        return 0;
    }