#include<stdio.h>
struct node
{
    int data;
    struct node*next;
};
int main()
{
    struct node *a=NULL,*b=NULL,*c=NULL,*d=NULL,*e=NULL,*n,*head;
    scanf("%d",&n);
    a=(struct node*)malloc(sizeof(struct node));
    b=(struct node*)malloc(sizeof(struct node));
    c=(struct node*)malloc(sizeof(struct node));
    d=(struct node*)malloc(sizeof(struct node));
    e=(struct node*)malloc(sizeof(struct node));
     scanf("%d ",&a->data);
    scanf("%d ",&b->data);
    scanf("%d ",&c->data);
    scanf("%d ",&d->data);
    scanf("%d ",&e->data);
    
    head=a->data;
    a->next=b->data;
    b->next=c->data;
    c->next=d->data;
    d->next=e->data;
    e->next=NULL;
    struct node*temp=a;
    while(temp!=NULL)
    {
        printf("%d ",temp->data);
        temp=temp->next;
    }
    return 0;
   
}