// editor3
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int id;
    char p[100];
    struct node *next;
}nd;
nd *front=NULL,*rear;
void enqueue(char* x,int y){
    nd *newnode=(nd*)malloc(sizeof(nd));
    newnode->id=y;
    newnode->p=x;
    newnode->next=NULL;
    if(front==NULL){
        front=rear=newnode;
    }
    else{
        rear->next=newnode;
        rear=newnode;
    }
}
void dequeue(){
    nd *temp=front;
    while(front!=NULL){
        printf("%d ",temp->id);
    }temp=temp->next;
}
int main(){
    int n;
    scanf("%d",&n);
    char x[80];
    int y;
    scanf("%s %d",x,&y);
    enqueue(x,y);
    dequeue();
}