#include <bits/stdc++.h>
using namespace std;
struct node {
  int p, s, n;
  node(int p = -1, int s = -1, int n = -1) : p(p), s(s), n(n) {}
};
node operacion(node a, node b) {
  if (a.n == -1) return b;
  if (b.n == -1) return a;
  node ret;
  ret.n = a.n + b.n;
  if (a.p == a.n)
    ret.p = a.p + b.p;
  else
    ret.p = a.p;
  if (b.s == b.n)
    ret.s = a.s + b.s;
  else
    ret.s = b.s;
  return ret;
}
const node neutro;
struct RMQ {
  int sz;
  int nn;
  node t[4 * 515];
  node &operator[](int p) { return t[sz + p]; }
  void init(int n) {
    nn = n;
    sz = 1 << (32 - __builtin_clz(n));
    for (int i = (0); i < (2 * sz); i++) t[i] = neutro;
  }
  void updall() {
    for (int i = sz - 1; i >= 0; i--) t[i] = operacion(t[2 * i], t[2 * i + 1]);
  }
  node get(int i, int j) { return get(i, j, 1, 0, sz); }
  node get(int i, int j, int n, int a, int b) {
    if (j <= a || i >= b) return neutro;
    if (i <= a && b <= j) return t[n];
    int c = (a + b) / 2;
    return operacion(get(i, j, 2 * n, a, c), get(i, j, 2 * n + 1, c, b));
  }
  void set(int p, node val) {
    p += sz;
    while (p > 0) {
      t[p] = val;
      p /= 2;
      val = operacion(t[p * 2], t[p * 2 + 1]);
    }
  }
};
int solve(int rr, int c, vector<RMQ> &vst) {
  int ret = 0, aux;
  int L = 0, R = vst[0].nn - 1;
  for (int i = rr + 1 - 1; i >= 0; i--) {
    if (vst[i][c].p == 0) break;
    if (ret >= (R - L + 1) * (rr + 1)) break;
    if (L < c) {
      aux = vst[i].get(L, c).s;
      assert(c - aux >= L && c - aux <= c);
      L = c - aux;
    }
    if (R > c) {
      aux = vst[i].get(c + 1, R + 1).p;
      assert(c + aux <= R && c + aux >= c);
      R = c + aux;
    }
    ret = max(ret, (R - L + 1) * (rr - i + 1));
  }
  L = 0, R = vst[0].nn - 1;
  for (int i = (rr); i < (((int)vst.size())); i++) {
    if (vst[i][c].p == 0) break;
    if (ret >= (R - L + 1) * (((int)vst.size()) - rr)) break;
    if (L < c) {
      aux = vst[i].get(L, c).s;
      assert(c - aux >= L && c - aux <= c);
      L = c - aux;
    }
    if (R > c) {
      aux = vst[i].get(c + 1, R + 1).p;
      assert(c + aux <= R && c + aux >= c);
      R = c + aux;
    }
    ret = max(ret, (R - L + 1) * (i - rr + 1));
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, q;
  cin >> n >> m >> q;
  vector<RMQ> st[2];
  st[0].resize(n);
  st[1].resize(m);
  for (int i = (0); i < (n); i++) st[0][i].init(m);
  for (int j = (0); j < (m); j++) st[1][j].init(n);
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (m); j++) {
      int x;
      cin >> x;
      st[1][j][i] = st[0][i][j] = node(x, x, 1);
    }
  for (int i = (0); i < (n); i++) st[0][i].updall();
  for (int j = (0); j < (m); j++) st[1][j].updall();
  for (int i = (0); i < (q); i++) {
    int t, x, y;
    cin >> t >> x >> y;
    x--;
    y--;
    if (t == 1) {
      int aux = 1 - st[0][x][y].p;
      st[0][x].set(y, node(aux, aux, 1));
      st[1][y].set(x, node(aux, aux, 1));
    } else
      cout << max(solve(x, y, st[0]), solve(y, x, st[1])) << '\n';
  }
  return 0;
}
