#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node{
    char data[100];
    struct node *next;
};
struct node *head=NULL;

int createList(){
    struct node* newnode=(struct node*)malloc(sizeof(struct node));
    scanf("%s ", newnode-> data);
    newnode->next = NULL;
    int len=strlen(newnode->data);
    for(int i=0;i<len;i++)
    {
        if((newnode->data[i]>='A' && newnode->data[i]<='Z') || (newnode->data[i]>='a'  && newnode->data[i]<='z') || (newnode->data[i]>='0' && newnode->data[i]>='9'))
        {
            continue;
        }
        else
        {
            printf("Invalid input");
            return -1;
        }
    }
    struct node *temp;
    if(head==NULL)
    {
        head=temp=newnode;
    }
    else
    {
        temp=head;
        while(temp->next!=NULL)
        {
            temp=temp->next;
        }
        temp->next=newnode;
    }
    return 0;
}
void display(){
    struct node *temp=head;
    while(temp!=NULL)
    {
        printf("%s",temp->data);
        temp=temp->next;
    }
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i,n;i++)
    {
        if(createList()==-1)
        {
            return 0;
        }
        display();
    }
}