#include <bits/stdc++.h>
using namespace std;
const auto INF = 0x3f3f3f3f;
const int N = 1e3 + 5;
int a[N][N], L[N][N], R[N][N], U[N][N], D[N][N], n, m;
void getLR(int i) {
  for (int j = 1; j <= m; j++) {
    if (a[i][j])
      L[i][j] = L[i][j - 1] + 1;
    else
      L[i][j] = 0;
  }
  for (int j = m; j >= 1; j--) {
    if (a[i][j])
      R[i][j] = R[i][j + 1] + 1;
    else
      R[i][j] = 0;
  }
}
void getUD(int j) {
  for (int i = 1; i <= n; i++) {
    if (a[i][j])
      U[i][j] = U[i - 1][j] + 1;
    else
      U[i][j] = 0;
  }
  for (int i = n; i >= 1; i--) {
    if (a[i][j])
      D[i][j] = D[i + 1][j] + 1;
    else
      D[i][j] = 0;
  }
}
int main() {
  int k;
  scanf("%d%d%d", &n, &m, &k);
  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++) {
    getLR(i);
  }
  for (int j = 1; j <= m; j++) {
    getUD(j);
  }
  while (k--) {
    int id, x, y;
    scanf("%d%d%d", &id, &x, &y);
    if (id == 1) {
      a[x][y] = !a[x][y];
      getLR(x);
      getUD(y);
    } else {
      int l, r;
      l = y - L[x][y] + 1;
      r = y + R[x][y] - 1;
      int maxx = 0, minnU, minnD, MinU, MinD;
      MinU = MinD = INF;
      for (int i = y; i >= l; i--) {
        MinU = min(MinU, U[x][i]);
        MinD = min(MinD, D[x][i]);
        minnU = MinU;
        minnD = MinD;
        for (int j = y; j <= r; j++) {
          minnU = min(minnU, U[x][j]);
          minnD = min(minnD, D[x][j]);
          maxx = max(maxx, minnU * (j - i + 1));
          maxx = max(maxx, minnD * (j - i + 1));
          if (i == y || j == y)
            maxx = max(maxx, (minnU + minnD - 1) * (j - i + 1));
        }
      }
      printf("%d\n", maxx);
    }
  }
}
