#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
bool b[4][1010][1010];
int dp[4][1010][1010];
void init(int k, int N, int M) {
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      if (b[k][i][j] == 0) continue;
      dp[k][i][j] = 1 + dp[k][i - 1][j];
    }
  }
}
void upd(int k, int i0, int j0, int N, int M) {
  if (b[k][i0][j0] == 0) {
    b[k][i0][j0] = 1;
    for (int i = i0; i <= N; i++) {
      if (b[k][i][j0] == 0) continue;
      dp[k][i][j0] = dp[k][i - 1][j0] + 1;
    }
  } else {
    b[k][i0][j0] = 0;
    dp[k][i0][j0] = 0;
    for (int i = i0; i <= N; i++) {
      if (b[k][i][j0] == 0) continue;
      dp[k][i][j0] = dp[k][i - 1][j0] + 1;
    }
  }
}
int query(int k, int i0, int j0, int N, int M) {
  if (b[k][i0][j0] == 0) return 0;
  int best = 0;
  int l = j0, r = j0, h = dp[k][i0][j0];
  while (h > 0) {
    while (dp[k][i0][l] >= h) l--;
    while (dp[k][i0][r] >= h) r++;
    best = max(best, h * (r - l - 1));
    h = min(h, max(dp[k][i0][l], dp[k][i0][r]));
  }
  return best;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int N, M, Q;
  cin >> N >> M >> Q;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      cin >> b[0][i][j];
      b[1][j][i] = b[0][i][j];
      b[2][N + 1 - i][j] = b[0][i][j];
      b[3][M + 1 - j][i] = b[0][i][j];
    }
  }
  init(0, N, M);
  init(1, M, N);
  init(2, N, M);
  init(3, M, N);
  while (Q--) {
    int op, i, j;
    cin >> op >> i >> j;
    if (op == 1) {
      upd(0, i, j, N, M);
      upd(1, j, i, M, N);
      upd(2, N + 1 - i, j, N, M);
      upd(3, M + 1 - j, i, M, N);
    } else {
      int res = 0;
      res = max(res, query(0, i, j, N, M));
      res = max(res, query(1, j, i, M, N));
      res = max(res, query(2, N + 1 - i, j, N, M));
      res = max(res, query(3, M + 1 - j, i, M, N));
      cout << res << '\n';
    }
  }
  return 0;
}
