#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
typedef struct node{
    char*data;
    struct node* next;
}node;
node* createnode(char *data){
    node* newnode=(node*)malloc(sizeof(node));
    if(!newnode){
        printf("Memory allocation fails");
        exit(1);
    }
    newdataNode->data=data;
    newnode->next=NULL;
    return newnode;
}
void printlist(node* node){
    node*temp=head;
    while(temp){
        printf("%s",temp->data);
        if(temp->next!=NULL)
        printf(" ");
        temp=temp->next;
    }
}
int tocheck(char*data){
    for(int i=0;data[i]='\0';i++){
        if(!isalnum(data[i])){
            return 0;
        }
    }
}
int main(){
    int n;
    scanf("%d",&n);
    char temp[100];
    node*head=NULL,*tail=NULL;
    for(int i=1;i<=n;i++){
        scanf("%s",temp);
        if(!tocheck(temp)){
            printf("Invalid input");
            return 0;
        }
    }
    node*n1=createnode(temp);
    if(head==NULL){
        head=tail=n1;
    }else{
        tail->next=n1;tail=n1;
    }
    printlist(head);
    return 0;
}