#include <bits/stdc++.h>
using namespace std;
int o[1002][1002], v[1002][1002], tmp[1002][1002];
int acc[1002][1002];
int op[1002], cl[1002], rw[1002];
int ans[1002];
int n, m, q;
void rotate() {
  for (int j = 1; j <= m; ++j)
    for (int i = n; i >= 1; --i) tmp[j][n + 1 - i] = o[i][j];
  for (int i = 0; i < q; ++i) {
    int pr = rw[i], pc = cl[i];
    rw[i] = pc;
    cl[i] = n + 1 - pr;
  }
  swap(n, m);
  memcpy(o, tmp, sizeof tmp);
}
void solve() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) acc[i][j] = v[i][j] + acc[i][j - 1];
  for (int i = 0; i < q; ++i) {
    int qr = rw[i], qc = cl[i];
    if (op[i] == 1) {
      v[qr][qc] ^= 1;
      for (int j = 1; j <= m; ++j) acc[qr][j] = v[qr][j] + acc[qr][j - 1];
    } else {
      if (v[qr][qc] == 0) {
        int lo = qc, hi = qc;
        while (lo - 1 >= 1 && v[qr][lo - 1] == 0) --lo;
        while (hi + 1 <= m && v[qr][hi + 1] == 0) ++hi;
        for (int j = qr; j <= n && v[j][qc] == 0; ++j) {
          while (acc[j][qc] - acc[j][lo - 1]) ++lo;
          while (acc[j][hi] - acc[j][qc - 1]) --hi;
          ans[i] = max(ans[i], (hi - lo + 1) * (j - qr + 1));
        }
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) scanf("%d", o[i] + j), o[i][j] ^= 1;
  for (int i = 0; i < q; ++i) scanf("%d%d%d", op + i, rw + i, cl + i);
  for (int i = 0; i < 4; ++i) {
    memcpy(v, o, sizeof o);
    solve();
    rotate();
  }
  for (int i = 0; i < q; ++i)
    if (op[i] == 2) printf("%d\n", ans[i]);
  return 0;
}
