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