#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, m, q;
int a[N][N];
int dp[4][N][N];
int cal(int x[], int l, int pos) {
  int pre[N], nxt[N];
  pre[0] = -1;
  nxt[l - 1] = l;
  int stk[N], stop = 0;
  stk[stop++] = 0;
  for (int i = 1; i < l; i++) {
    while (stop && x[i] <= x[stk[stop - 1]]) stop--;
    if (stop) {
      pre[i] = stk[stop - 1];
    } else {
      pre[i] = -1;
    }
    stk[stop++] = i;
  }
  stop = 0;
  stk[stop++] = l - 1;
  for (int i = l - 2; i >= 0; i--) {
    while (stop && x[i] <= x[stk[stop - 1]]) stop--;
    if (stop) {
      nxt[i] = stk[stop - 1];
    } else {
      nxt[i] = l;
    }
    stk[stop++] = i;
  }
  int ret = 0;
  for (int i = 0; i < l; i++) {
    if (pre[i] < pos && pos < nxt[i]) {
      ret = max(ret, (nxt[i] - pre[i] - 1) * x[i]);
    }
  }
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int i = 0; i < m; i++) dp[0][0][i] = a[0][i];
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < m; j++) {
      dp[0][i][j] = (a[i][j] == 0 ? 0 : dp[0][i - 1][j] + 1);
    }
  }
  for (int i = 0; i < m; i++) dp[1][n - 1][i] = a[n - 1][i];
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < m; j++) {
      dp[1][i][j] = (a[i][j] == 0 ? 0 : dp[1][i + 1][j] + 1);
    }
  }
  for (int i = 0; i < n; i++) dp[2][i][0] = a[i][0];
  for (int i = 1; i < m; i++) {
    for (int j = 0; j < n; j++) {
      dp[2][j][i] = (a[j][i] == 0 ? 0 : dp[2][j][i - 1] + 1);
    }
  }
  for (int i = 0; i < n; i++) dp[3][i][m - 1] = a[i][m - 1];
  for (int i = m - 2; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      dp[3][j][i] = (a[j][i] == 0 ? 0 : dp[3][j][i + 1] + 1);
    }
  }
  while (q--) {
    int op, x, y;
    scanf("%d%d%d", &op, &x, &y);
    x--;
    y--;
    if (op == 1) {
      a[x][y] ^= 1;
      dp[0][0][y] = a[0][y];
      for (int i = 1; i < n; i++) {
        dp[0][i][y] = (a[i][y] == 0 ? 0 : dp[0][i - 1][y] + 1);
      }
      dp[1][n - 1][y] = a[n - 1][y];
      for (int i = n - 2; i >= 0; i--) {
        dp[1][i][y] = (a[i][y] == 0 ? 0 : dp[1][i + 1][y] + 1);
      }
      dp[2][x][0] = a[x][0];
      for (int i = 1; i < m; i++) {
        dp[2][x][i] = (a[x][i] == 0 ? 0 : dp[2][x][i - 1] + 1);
      }
      dp[3][x][m - 1] = a[x][m - 1];
      for (int i = m - 2; i >= 0; i--) {
        dp[3][x][i] = (a[x][i] == 0 ? 0 : dp[3][x][i + 1] + 1);
      }
    } else {
      int ans = 0;
      int cur[N];
      ans = max(ans, cal(dp[0][x], m, y));
      ans = max(ans, cal(dp[1][x], m, y));
      for (int i = 0; i < n; i++) cur[i] = dp[2][i][y];
      ans = max(ans, cal(cur, n, x));
      for (int i = 0; i < n; i++) cur[i] = dp[3][i][y];
      ans = max(ans, cal(cur, n, x));
      printf("%d\n", ans);
    }
  }
  return 0;
}
