#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
struct Node{
    char name[101];
    struct Node*next;
};
int isValid(char*s){
    for(int i=0;s[i];i++){
        if(!isalpha(s[i]))
        return 0;
    }
    return 1;
}
void insertAtEnd(struct Node**head,char*name){
    struct Node*newNode=(struct Node)malloc (sizeof(struct Node));
    strcpy(newNode->name,name);
    newNode->next=NULL;
    if(*head==NULL){
        head=newNode;
        return;
    }
    struct Node*temp=*head;
    while(temp->next!=NULL){
        temp=temp->next;
        temp->next=newNode;
    }
}
void displayList(struct Node*head){
    while(head!=NULL){
        printf("%s",head->name);
        if(head->next!=NULL)
    }
    printf("\n");
}
int main(){
    int n;
    scanf("%d",&n);
    struct Node*head=NULL'
    char name[101];
    for(int i=0;i<n;i++){
       scanf("%s",name);
       if(!isVailid(name)){
          printf("Invalid input\n");
          return 0;
        }
       insertAtEnd(&head,name);
    }
    displayList(head);
    return 0;
}