// editor2

#include<stdio.h>
#include<stdlib.h>

typedef struct route
{
    int n;
    struct route *next;
}node;

node *head=NULL,*tail;
node *newnode=(node*)malloc(sizeof(node));

void create(int data)
{
    node *head=NULL,*tail;
    node *newnode=(node*)malloc(sizeof(node));
    newnode->n=data;
    newnode->next=NULL;
    if(head==NULL)
    {
        head=newnode;
        tail=newnode;
    }
    else
    {
        tail->next=newnode;
        tail=newnode;
    }
}

void deletenode(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);
}

void print()
{
    for(int i=0;head->next!=NULL;i++)
    {
        printf("%d ",head->n);
        head=head->next;
    }
}

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);
    deletenode(ind);
    print();
}