#include <stdio.h>
#include<string.h>
#define MAX 100000+10
char s[MAX];
char tmp[MAX];
int main() {
int n;
while(~scanf("%d",&n))
{
if(n==0)return 0;
while(getchar()!='
')
;
gets(s);
int len=strlen(s);
int i=0;
while(i<len)
{
int j=0;
while(i<len&&s[i]==' ')
{
i++;
j++;
}
if(j>0)
printf(" ");
j=0;
while(i<len&&s[i]!=' ')
{
tmp[j++]=s[i];
i++;
}
if(j>0)
{
for(int p=0,q=j⑴;p<q;++p,--q)
{
char t=tmp[p];
tmp[p]=tmp[q];
tmp[q]=t;
}
tmp[j]='