#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    char data;
    struct node *prev;
    struct node *next;
} s1;

s1 *head=NULL,*tail=NULL;

void create(char c){
    s1 *new=(s1*)malloc((sizeof(s1)));
    new->data=c;
    new->prev=NULL;
    new->next=NULL;
    if(head==NULL){
        head=new;
        tail=new;
    }else{
        tail->next=new;
        new->prev=tail;
        tail=new;
    }
}

void display(){
    s1 *i;
    for(i=head;i!=NULL;i=i->next){
        printf("%c ",i->data);
    }
}

int main(){
    int size;
    
    scanf("%d",&size);
    char c[size];
    for(int i=0;i<size;i++){
        scanf("%c ",c[i]);
        printf("%c ",c[i]);
        create(c);
    }
    display();
    return 0;
}