#include <cstdio>

int main()
{
  int nt = 0;
  char a[999], b[999], c[999], d[999];
  while (gets(a) && gets(b) && gets(c) && gets(d))
  {
    char fn[99];
    sprintf(fn, "%02d", ++nt);
    FILE *f = fopen(fn, "w");
    fprintf(f, "%s\n%s\n%s\n%s\n0\n", a, b, c, d);
    fclose(f);
  }
  return 0;
}
