#include <bits/stdc++.h>
using namespace std;
int n, m;
set<int> s1[1109], s2[1109];
bool b[1109][1109];
int main() {
  int Q;
  scanf("%d%d%d", &n, &m, &Q);
  int x, y;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      scanf("%d", &x);
      if (x == 1) continue;
      b[i][j] = true;
      s1[i].insert(j);
      s2[j].insert(i);
    }
  for (int i = 1; i <= n; i++) {
    s1[i].insert(0);
    s1[i].insert(m + 1);
  }
  for (int i = 1; i <= m; i++) {
    s2[i].insert(0);
    s2[i].insert(n + 1);
  }
  int op;
  while (Q--) {
    scanf("%d", &op);
    scanf("%d%d", &x, &y);
    if (op == 1) {
      if (b[x][y])
        s1[x].erase(y), s2[y].erase(x);
      else
        s1[x].insert(y), s2[y].insert(x);
      b[x][y] = !b[x][y];
    } else {
      if (b[x][y]) {
        printf("0\n");
        continue;
      }
      int Ans = 1;
      int L = 1, R = m;
      for (int i = x; i; i--) {
        if (b[i][y]) break;
        int r = *s1[i].lower_bound(y) - 1;
        int l = *(--s1[i].lower_bound(y)) + 1;
        L = max(L, l);
        R = min(R, r);
        Ans = max(Ans, (R - L + 1) * (x - i + 1));
      }
      L = 1, R = m;
      for (int i = x; i <= n; i++) {
        if (b[i][y]) break;
        int r = *s1[i].lower_bound(y) - 1;
        int l = *(--s1[i].lower_bound(y)) + 1;
        L = max(L, l);
        R = min(R, r);
        Ans = max(Ans, (R - L + 1) * (i - x + 1));
      }
      L = 1, R = n;
      for (int i = y; i; i--) {
        if (b[x][i]) break;
        int r = *s2[i].lower_bound(x) - 1;
        int l = *(--s2[i].lower_bound(x)) + 1;
        L = max(L, l);
        R = min(R, r);
        Ans = max(Ans, (R - L + 1) * (y - i + 1));
      }
      L = 1, R = n;
      for (int i = y; i <= m; i++) {
        if (b[x][i]) break;
        int r = *s2[i].lower_bound(x) - 1;
        int l = *(--s2[i].lower_bound(x)) + 1;
        L = max(L, l);
        R = min(R, r);
        Ans = max(Ans, (R - L + 1) * (i - y + 1));
      }
      printf("%d\n", Ans);
    }
  }
  return 0;
}
