#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
struct MeNode{
    char me[101];
    struct MeNode* prev;
    struct MeNode* next;
};
int freeTheList(struct MeNode* head){
    struct MeNode* cr = head;
    while(cr != NULL){
        struct MeNode* temp = cr;
        cr = cr->next;
        free(temp;)
    }
    return 1;
}
int main(){
    int n, i, j;
    struct MeNode *head = NULL, *tail = NULL;
    char buffer[101];
    if(scanf("%d", &n) != 1){
        printf("Invalid input");
        return 1;
    }
    for(i=0; i<n; i++){
        scanf("%100s", buffer);
        for(j=0; buffer[j] != '\0'; j++){
            if(isdigit(buffer[j])){
                printf("Invalid input");
                freeTneList(head);
                return 1;
            }
        }
        struct MeNode* newNode = (struct MeNode*)malloc(sizeof(struct MeNode));
        strcpy(newNode->me, buffer);
        newNode->next = NULL;
        if(head == NULL){
            newNode->prev = NULL;
            head = tail = newNode;
        }else{
            tail->next = newNode;
            newNode->prev = tail;
            tail = newNode;
        }
    }
    struct MeNode* cr = head;
    while(cr != NULL){
        printf("%s\n", cr->me);
        cr = cr->next;
    }
    freeTheList(head);
    return 0;
}