
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <cassert>

using namespace std;

int n, m, k;

int init_prg() {
   scanf("%d%d%d", &n,&m,&k);
   for (int l = 0; l < k; ++l) {
      int h,w;
      scanf("%d%d", &h,&w);
      char ch;
      for (int i = 0; i < w; ++i)
         for (int j = 0; j < h; ++j)
            cin >> ch;
   }
   cout << "TOO MANY";
   return 0;
}

int main() {

   freopen("g.in","r",stdin);
   freopen("g.out","w",stdout);

   return init_prg();
}
