// editor2
#include <stdio.h>
#include <stdlib.h>
struct Node{
    int data;
    struct Node*next;
};
int main(){
    int N,p,i,value;
    scanf("%d",&N);
    if(N<=0){
        printf("Invalid input");
        return 0;
    }
    struct Node*head=NULL,*temp=NULL,*newNode=NULL;
    for(i=0;i<N;i++){
        scanf("%d",&value);
        newNode=(struct Node*)malloc(sizeof(struct Node));
        newNode->next=NULL;
        if(head==NULL){
            head=newNode;
            temp=head;
        }else{
            temp->next=newNode;
            temp=newNode;
        }
    }
    scanf("%d ",&p);
    if(P<0||P>=N){
        printf("Invalid Input");
        return 0;
    }
    if(p==0){
        temp=head;
        head=head->next;
        free(temp);
        
    }else{
        struct Node*prev=head;
        for(i=0;i<p-1;i++){
            prev=prev->next;
        }
        temp=prev->next;
        prev->next=time->next;
        free(temp);
    }
    temp=head;
    while(temp!=NULL){
        printf("%d ",temp->data);
        temp=temp->next;
    }
return 0;
    
    
}