#include <iostream>
#include <cstdio>
#include <cstdlib>
#define MaxSize 100
using namespace std ;
typedef int ElemType ;

// 队列顺序队列实现
typedef struct {
ElemType data[MaxSize] ;
int front , rear ; // 队头和队尾
}SqQueue ;
void InitQueue(SqQueue *&q)
{ q=(SqQueue *)malloc (sizeof(SqQueue));
q->front=q->rear=-1;
}
void DestroyQueue(SqQueue *&q) //销毁队列
{
free(q);
}
bool QueueEmpty(SqQueue *q) //判断队列是否为空
{
return(q->front==q->rear) ;
}
bool enQueue(SqQueue *&q,ElemType e) //进队
{ if (q->rear==MaxSize-1) //队满上溢出
return false; //返回假
q->rear++; //队尾增1
q->data[q->rear]=e; //rear位置插入元素e
return true; //返回真
}
bool deQueue(SqQueue *&q,ElemType &e) //出队
{ if (q->front==q->rear) //队空下溢出
return false;
q->front++;
e=q->data[q->front];
return true;
}
ElemType GetHead(SqQueue *q){
if(q->front == q->rear) {
exit(0) ;
}
int k = q->front+1 ;
return q->data[k] ;
}
int main(){

SqQueue *Q ;
InitQueue(Q) ;
int n ;
cin >> n ;
for(int i = 0 ; i<n ; i++) {
ElemType x ;
cin >> x ;
enQueue(Q,x) ;
}

while(!QueueEmpty(Q)){
ElemType e ;
ElemType x = GetHead(Q);
deQueue(Q,e) ;
cout<<x<<endl ;

}

return 0 ;
}