#include <cstdio>

int k = 0;

void split()
{
  int n;
  while (scanf("%d", &n) == 1)
  {
    char buf[99];
    sprintf(buf, "%02d", ++k);

    FILE *F = fopen(buf, "wt");
    fprintf(F, "%d\n", n);
    char a[1100];
    for (int i = 0; i <= n; i++)
    {
      scanf("%s", a);
      fprintf(F, "%s\n", a);
    }
    
    fclose(F);
  }
}

int main()
{

  freopen("tests.hand", "r", stdin);
  split();
  freopen("tests", "r", stdin);
  split();
  return 0;
}
