#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	int i=0,j;
	char **cp;
	char temp[50]="1";

	cp=(char **)malloc(5*sizeof(char));
//	gets(temp);
	while(strlen(temp))
	{
		gets(temp);
	
		cp[i] = (char *)malloc(strlen(temp)+1);
		strcpy(cp[i],temp);
		i++;
		if (i%5==0) cp = (char **)realloc(cp,(i+5)*sizeof(char));
	}
	cp = (char **)realloc(cp,i*sizeof(char));
	i--;

	for(j=0;j<i;j++)
	{
//		printf("%s\n",cp[j]);
		puts(cp[j]);

	}
//*/
	return 0;
}