#include <bits/stdc++.h>
using namespace std;
const int INF = 2000;
const int MAXN = 1005;
int a[MAXN][MAXN];
int dp[MAXN][MAXN][4];
int ans;
int n, m;
void r(int x, int y) {
  int l = INF, r = INF;
  for (int k = 0; y + k <= m; k++) {
    if (a[x][y + k] == 0) return;
    int ll = dp[x][y + k][2] - 1, rr = dp[x][y + k][3] - 1;
    l = min(l, ll);
    r = min(r, rr);
    ans = max(ans, (r + l + 1) * (k + 1));
  }
}
void l(int x, int y) {
  int l = INF, r = INF;
  for (int k = 0; y - k >= 1; k++) {
    if (a[x][y - k] == 0) return;
    int ll = dp[x][y - k][2] - 1, rr = dp[x][y - k][3] - 1;
    l = min(l, ll);
    r = min(r, rr);
    ans = max(ans, (r + l + 1) * (k + 1));
  }
}
void u(int x, int y) {
  int l = INF, r = INF;
  for (int k = 0; x - k >= 1; k++) {
    if (a[x - k][y] == 0) return;
    int ll = dp[x - k][y][0] - 1, rr = dp[x - k][y][1] - 1;
    l = min(l, ll);
    r = min(r, rr);
    ans = max(ans, (r + l + 1) * (k + 1));
  }
}
void d(int x, int y) {
  int l = INF, r = INF;
  for (int k = 0; x + k <= n; k++) {
    if (a[x + k][y] == 0) return;
    int ll = dp[x + k][y][0] - 1, rr = dp[x + k][y][1] - 1;
    l = min(l, ll);
    r = min(r, rr);
    ans = max(ans, (r + l + 1) * (k + 1));
  }
}
int main() {
  int q;
  scanf("%d%d%d", &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++)
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == 1) {
        dp[i][j][1] = dp[i][j - 1][1] + 1;
        dp[i][j][2] = dp[i - 1][j][2] + 1;
      }
    }
  for (int i = n; i >= 1; i--)
    for (int j = m; j >= 1; j--) {
      if (a[i][j] == 1) {
        dp[i][j][0] = dp[i][j + 1][0] + 1;
        dp[i][j][3] = dp[i + 1][j][3] + 1;
      }
    }
  while (q--) {
    int o, x, y;
    scanf("%d%d%d", &o, &x, &y);
    if (o == 1) {
      a[x][y] ^= 1;
      if (a[x][y] == 1) {
        dp[x][y][0] = 1 + dp[x][y + 1][0];
        dp[x][y][1] = 1 + dp[x][y - 1][1];
        dp[x][y][2] = 1 + dp[x - 1][y][2];
        dp[x][y][3] = 1 + dp[x + 1][y][3];
        for (int i = 1; y + i <= m && a[x][y + i] == 1; i++)
          dp[x][y + i][1] = dp[x][y + i - 1][1] + 1;
        for (int i = 1; y - i >= 1 && a[x][y - i] == 1; i++)
          dp[x][y - i][0] = dp[x][y - i + 1][0] + 1;
        for (int i = 1; x - i >= 1 && a[x - i][y] == 1; i++)
          dp[x - i][y][3] = dp[x - i + 1][y][3] + 1;
        for (int i = 1; x + i <= n && a[x + i][y] == 1; i++)
          dp[x + i][y][2] = dp[x + i - 1][y][2] + 1;
      } else {
        dp[x][y][0] = dp[x][y][1] = dp[x][y][2] = dp[x][y][3] = 0;
        for (int i = 1; y + i <= m && a[x][y + i] == 1; i++)
          dp[x][y + i][1] = dp[x][y + i - 1][1] + 1;
        for (int i = 1; y - i >= 1 && a[x][y - i] == 1; i++)
          dp[x][y - i][0] = dp[x][y - i + 1][0] + 1;
        for (int i = 1; x - i >= 1 && a[x - i][y] == 1; i++)
          dp[x - i][y][3] = dp[x - i + 1][y][3] + 1;
        for (int i = 1; x + i <= n && a[x + i][y] == 1; i++)
          dp[x + i][y][2] = dp[x + i - 1][y][2] + 1;
      }
    } else {
      ans = 0;
      r(x, y);
      l(x, y);
      u(x, y);
      d(x, y);
      printf("%d\n", ans);
    }
  }
  return 0;
}
