// editor2
#include<stdio.h>
#include<stdlib.h>

typedef struct doubly
{
    int data;
    struct doubly *prev,*next;
}node;

node *head=NULL,*tail;

void create(int n)
{
    node *nd=(node*)malloc(sizeof(node));
    nd->data=n;
    nd->prev=nd->next=NULL;
    
    if(head==NULL)
    {
     head=tail=nd;   
    }
    else
    {
        nd->prev=tail;
        tail->next=nd;
        tail=nd;
    }
    head->prev=tail;
    tail->next=head;
}

void print()
{
    node *temp=head;
    int graeter=temp->data;
    do
    {
        if(temp->data>=greater)
        {
            greater=temp->data;
        }
        temp=temp->next;
    }while(temp!=head);
    printf("%d",greater);
}

int main()
{
    int n,data;
    scanf("%d",&n);
    if(n<=0)
    {
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        scanf("%d",&n);
        create(data);
    }
}