#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
typedef struct {
  int pre[maxn];
  void init(int n) {
    for (int i = 0; i <= n + 1; ++i) pre[i] = i;
  }
  int find(int x) {
    if (x == pre[x]) return x;
    return pre[x] = find(pre[x]);
  }
  void merge(int x, int y) { pre[find(x)] = find(y); }
} DS;
DS lds, rds;
int n, m, q;
int M[maxn][maxn];
int D[maxn][maxn];
int U[maxn][maxn];
int L[maxn][maxn];
int R[maxn][maxn];
int a[maxn];
int id[maxn];
bool comp(int x, int y) { return a[x] < a[y]; }
int getMax(int n, int x) {
  int ret = 0;
  int l, r;
  int i;
  for (i = 1; i <= n; ++i) id[i] = i;
  lds.init(n);
  rds.init(n);
  sort(id + 1, id + 1 + n, comp);
  for (i = n; i > 0; --i) {
    l = lds.find(id[i] - 1) + 1;
    r = rds.find(id[i] + 1) - 1;
    if (l <= x && x <= r) ret = max(ret, (r - l + 1) * a[id[i]]);
    lds.merge(id[i], id[i] - 1);
    rds.merge(id[i], id[i] + 1);
  }
  return ret;
}
void printMat(int x[][maxn]) {
  int i, j;
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= m; ++j) printf("%d ", x[i][j]);
    putchar('\n');
  }
}
int main() {
  int i, j, k;
  int ans;
  int op, x, y;
  scanf("%d %d %d", &n, &m, &q);
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) scanf("%d", &M[i][j]);
  memset(D, 0, sizeof(D));
  memset(U, 0, sizeof(U));
  memset(L, 0, sizeof(L));
  memset(R, 0, sizeof(R));
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= m; ++j) {
      if (M[i][j]) {
        U[i][j] = U[i - 1][j] + 1;
        L[i][j] = L[i][j - 1] + 1;
      }
    }
  }
  for (i = n; i > 0; --i) {
    for (j = m; j > 0; --j) {
      if (M[i][j]) {
        D[i][j] = D[i + 1][j] + 1;
        R[i][j] = R[i][j + 1] + 1;
      }
    }
  }
  while (q--) {
    scanf("%d %d %d", &op, &x, &y);
    if (op == 1) {
      M[x][y] = !M[x][y];
      for (j = y; j <= m; ++j) L[x][j] = M[x][j] ? L[x][j - 1] + 1 : 0;
      for (i = x; i <= n; ++i) U[i][y] = M[i][y] ? U[i - 1][y] + 1 : 0;
      for (j = y; j > 0; --j) R[x][j] = M[x][j] ? R[x][j + 1] + 1 : 0;
      for (i = x; i > 0; --i) D[i][y] = M[i][y] ? D[i + 1][y] + 1 : 0;
    } else {
      ans = 0;
      for (i = 1; i <= n; ++i) a[i] = L[i][y];
      ans = max(ans, getMax(n, x));
      for (i = 1; i <= n; ++i) a[i] = R[i][y];
      ans = max(ans, getMax(n, x));
      for (i = 1; i <= m; ++i) a[i] = U[x][i];
      ans = max(ans, getMax(m, y));
      for (i = 1; i <= m; ++i) a[i] = D[x][i];
      ans = max(ans, getMax(m, y));
      printf("%d\n", ans);
    }
  }
  return 0;
}
