// editor2
#include<stdio.h>
#include<stdlib.h>

struct node{
    int data;
    struct node *next;
};
struct node *head=NULL;
struct node *temp;

void createList(){
    struct node newnode= (struct node)malloc(sizeof(struct node));
    if(scanf("%d", &newnode->data)!=1){
        printf("Invalid input");
        exit(0);
    }
    newnode->next=NULL;
    if(head==NULL){
        head=temp=newnode;
    }
    else{
        newnode->next=head;
        head=newnode;
    }
}

void display(){
    struct node *temp=head;
    while(temp!=NULL){
        printf("%d ", temp->data);
        temp=temp->next;
    }
}

int main(){-
    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        createList();
    }
    display()
}