#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int GetStr(char *s)
{
int n=0;
scanf("%1000[^\n]%n", s, &n);
while (getchar() != '\n');
if (n==0)
*s = '\0';
return n+1;
}
void main()
{
char s[1001], *p[100], *pi;
int i, n, m;
scanf("%d", &n);
while (getchar() != '\n');
if (n<1 || n>100)
return;
for (i=0; i<n; ++i)
{
m = GetStr(s);
p[i] = (char *)malloc(m*sizeof(char));
strcpy(p[i], s);
}
for (; i<100 && (m=GetStr(s)) && *s; ++i)
{
p[i] = (char *)malloc(m*sizeof(char));
strcpy(p[i], s);
}
m = i;
for (i=0; i<n; ++i)
printf("%s\n", p[i]);
for (; i<m; ++i)
{
pi = p[i];
while (*pi)
{
if (sscanf(pi,"%s%n",s,&n)==1)
{
printf("%s\n", s);
pi += n;
}
else
++pi;
}
}
for (i=0; i<m; ++i)
free(p[i]);
}