// editor2
 #include<stdio.h>
 #include<stdlib.h>
 typedef struct node{
     int data;
     struct node *next;
 }Node;
 Node *head=NULL , *tail;
 void create(int num){
     Node *newnode;
     newnode=(Node*) malloc (sizeof(Node));
     newnode->data=num;
     newnode->next=NULL;
     if(head==NULL){
         head=newnode;
         tail=newnode;
     }
     else{
         tail->next=newnode;
         tail=newnode;
     }
 }
 void display(){
     Node *temp=head;
     for (temp->next!=NUl){
         printf("%d ",temp->data);
         temp=temp->next
     }
     
 }
 void deletion(int ind){
     Node *temp=(Node*) malloc(sizeof(Node));
     Node *temp2=(Node*)malloc(sizeof(Node));
     temp=head;
     temp2=NULL;
     for(int i=0;i<ind;i++){
         temp2=temp;
         temp=temp->next;
     }
     temp2->next=temp->next;
     free(temp);
 }
 int main(){
     int n,ind,data;
     scanf("%d",&n);
     if(n<0){
         printf("invalid input");
         return 0;
     }
     for(int i=0;i<n;i++){
         scanf("%d",&data);
         create(data);
     }
     scanf("%d",&ind);
     if(ind>=n){
         printf("invalid input");
         return 0;
     }
     deletion(ind);
     display();
 }