#include <bits/stdc++.h>
using namespace std;
int a[1010][1010], m, n;
int L[1010][1010], R[1010][1010], D[1010][1010], U[1010][1010];
void update(int x, int y) {
  for (int i = m; i >= 1; i--) {
    if (a[x][i] == 0)
      R[x][i] = 0;
    else {
      R[x][i] = R[x][i + 1] + 1;
    }
  }
  for (int i = n; i >= 1; i--) {
    if (a[i][y] == 0)
      D[i][y] = 0;
    else {
      D[i][y] = D[i + 1][y] + 1;
    }
  }
  for (int i = 1; i <= m; i++) {
    if (a[x][i] == 0)
      L[x][i] = 0;
    else {
      L[x][i] = L[x][i - 1] + 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (a[i][y] == 0)
      U[i][y] = 0;
    else {
      U[i][y] = U[i - 1][y] + 1;
    }
  }
}
int find(int x, int y) {
  int ans = 0;
  int l, r, tt;
  l = 1999;
  r = 1999;
  tt = 0;
  for (int i = x; i <= n; i++) {
    if (a[i][y] == 0) break;
    l = min(l, L[i][y]);
    r = min(r, R[i][y]);
    tt++;
    ans = max(ans, (r + l - 1) * tt);
  }
  l = 1999;
  r = 1999;
  tt = 0;
  for (int i = x; i >= 1; i--) {
    if (a[i][y] == 0) break;
    l = min(l, L[i][y]);
    r = min(r, R[i][y]);
    tt++;
    ans = max(ans, (r + l - 1) * tt);
  }
  l = 1999;
  r = 1999;
  tt = 0;
  for (int i = y; i <= m; i++) {
    if (a[x][i] == 0) break;
    l = min(l, U[x][i]);
    r = min(r, D[x][i]);
    tt++;
    ans = max(ans, (r + l - 1) * tt);
  }
  l = 1999;
  r = 1999;
  tt = 0;
  for (int i = y; i >= 1; i--) {
    if (a[x][i] == 0) break;
    l = min(l, U[x][i]);
    r = min(r, D[x][i]);
    tt++;
    ans = max(ans, (r + l - 1) * tt);
  }
  return ans;
}
int main() {
  int i, j, mx, q;
  int x, y;
  while (scanf("%d%d%d", &n, &m, &q) != EOF) {
    memset(a, 0, sizeof(a));
    memset(L, 0, sizeof(L));
    memset(D, 0, sizeof(D));
    memset(R, 0, sizeof(R));
    memset(U, 0, sizeof(U));
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) scanf("%d", &a[i][j]);
    for (i = 1; i <= n; i++) update(i, i);
    for (i = 1; i <= m; i++) update(1, i);
    while (q--) {
      scanf("%d%d%d", &j, &x, &y);
      if (j == 1) {
        a[x][y] ^= 1;
        update(x, y);
      } else {
        printf("%d\n", find(x, y));
      }
    }
  }
  return 0;
}
