// editor2
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
struct Node
{
    int data;
    struct Node*next;
};
 struct Node*createNode(int data)
 {
     struct Node*newNode=(struct Node*)malloc(sizeof(struct node));
     newNode->data=data;
     newNode->next=NULL;
     return newNode;
 }
  void displayList(struct Node*head)
  {
      struct Node*temp=head;
      while(temp!=NULL)
      {
          printf("%d",temp->data);
          if(temp->next!=NULL)
          printf(" ");
          temp=temp->next;      
      }
  }
  int main()
  {
      int n;
      if(scanf("%d",&n)!=1||n<=0);
      {
          printf("Invalid input");
          return 0;
      }
      struct Node*head=NULL;
      struct Node*tail=NULL;
      for(int i=0;i<n;i++)
      {
          int value;
          if(scanf("%d",&value)!=1||value<0)
          {
              printf("Invalid input");
              return 0;
          }
      struct Node*newNode=createNode(value);
      if(head==NULL)
      {
          head=newNode;
          tail=newNode;
      }
      else
      {
          tail->next=newNode;
          tail=newNode;}
  }
  displayList(head);
  return 0;
  }