#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 10;
const int MOD = 1000000000 + 7;
int n, m, q;
int a[N][N];
int tol[N][N], tor[N][N], tou[N][N], tod[N][N];
void renewCol(int col) {
  tou[0][col] = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i][col] == 0)
      tou[i][col] = 0;
    else
      tou[i][col] = tou[i - 1][col] + 1;
  }
  tod[n + 1][col] = 0;
  for (int i = n; i >= 1; --i) {
    if (a[i][col] == 0)
      tod[i][col] = 0;
    else
      tod[i][col] = tod[i + 1][col] + 1;
  }
}
void renewRow(int row) {
  tol[row][0] = 0;
  for (int i = 1; i <= m; ++i) {
    if (a[row][i] == 0)
      tol[row][i] = 0;
    else
      tol[row][i] = tol[row][i - 1] + 1;
  }
  tor[row][m + 1] = 0;
  for (int i = m; i >= 1; --i) {
    if (a[row][i] == 0)
      tor[row][i] = 0;
    else
      tor[row][i] = tor[row][i + 1] + 1;
  }
}
void solve() {
  cin >> n >> m >> q;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int i = 1; i <= n; ++i) {
    renewRow(i);
  }
  for (int i = 1; i <= m; ++i) {
    renewCol(i);
  }
  int t, x, y;
  for (int tt = 0; tt < q; ++tt) {
    scanf("%d%d%d", &t, &x, &y);
    if (t == 1) {
      a[x][y] ^= 1;
      renewRow(x);
      renewCol(y);
    } else {
      int ret = 0;
      int fu, fd, fl, fr;
      fu = tou[x][y];
      fd = tod[x][y];
      for (int r = y; r <= m; ++r) {
        if (a[x][r] == 0) break;
        fu = min(fu, tou[x][r]);
        fd = min(fd, tod[x][r]);
        ret = max(ret, (r - y + 1) * (fu + fd - 1));
      }
      fu = tou[x][y];
      fd = tod[x][y];
      for (int r = y; r >= 1; --r) {
        if (a[x][r] == 0) break;
        fu = min(fu, tou[x][r]);
        fd = min(fd, tod[x][r]);
        ret = max(ret, (y - r + 1) * (fu + fd - 1));
      }
      fl = tol[x][y];
      fr = tor[x][y];
      for (int u = x; u >= 1; --u) {
        if (a[u][y] == 0) break;
        fl = min(fl, tol[u][y]);
        fr = min(fr, tor[u][y]);
        ret = max(ret, (x - u + 1) * (fl + fr - 1));
      }
      fl = tol[x][y];
      fr = tor[x][y];
      for (int u = x; u <= n; ++u) {
        if (a[u][y] == 0) break;
        fl = min(fl, tol[u][y]);
        fr = min(fr, tor[u][y]);
        ret = max(ret, (u - x + 1) * (fl + fr - 1));
      }
      cout << ret << endl;
    }
  }
}
int main() {
  solve();
  return 0;
}
