// editor5
#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=(Node*)malloc(1*sizeof(Node));
    newnode->data=num;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }
    else{
        tail->next=newnode;
        tail=newnode;
    }
}
void insertAtPos(int pos,int val){
    Node *newnode=(Node*)malloc(sizeof(Node));
    newnode->data = val;
    newnode->next = NULL:
    if(pos==1){
        newnode->next = head;
        head = newnode;
        return;
    }
    Node *temp = head;
    for(int i=1;i<pos-1 && temp !=NULL; i++){
        temp = temp-> next;
    }
    if(temp !=NULL){
        newnode->next = temp->next;
        temp->next = newnode;
    }
}
void display(){
    struct node *itr;
    for(itr=head; itr!=NULL; itr=itr->next){
        printf("%d ",itr->data);
    }
}
int main(){
    int size,num,itr,val,pos;
    scanf("%d",&size);
    if(size<=0){
        printf("Invalid input");
        return 0;
    }
    scanf("%d",&val);
    scanf("%d",&pos);
    if(pos<0 || pos> size +1){
        printf("Invalid input");
        return 0;
    }
    insertAtPos(pos,val);
    display();
    return 0;
}