#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
class SegmentTreeMin {
 public:
  int n;
  vector<int> vect;
  SegmentTreeMin(int _n) : n(_n) {
    vect.resize(2 * n);
    fill(vect.begin(), vect.end(), 1);
  }
  void modify(int p, int value) {
    for (vect[p += n] = value; p > 1; p >>= 1) {
      vect[p >> 1] = min(vect[p], vect[p ^ 1]);
    }
  }
  int query(int l, int r) {
    int res = 1;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) res = min(res, vect[l++]);
      if (r & 1) res = min(res, vect[--r]);
    }
    return res;
  }
};
int getr(SegmentTreeMin& stm, int minl, int maxr) {
  int l = minl, r = maxr, ql = minl;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (stm.query(ql, mid + 1)) {
      l = mid + 1;
      ql = mid + 1;
    } else
      r = mid;
  }
  return l;
}
int getl(SegmentTreeMin& stm, int minl, int maxr) {
  int l = minl, r = maxr, qr = maxr + 1;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (stm.query(mid + 1, qr)) {
      r = mid;
      qr = mid + 1;
    } else
      l = mid + 1;
  }
  return l;
}
int getAns(vector<SegmentTreeMin>& stv, int astart, int aend, int pos,
           int maxr) {
  int ans = 0;
  int dir = astart < aend ? 1 : -1;
  int l = 0, r = maxr;
  for (int i = astart; i != aend; i += dir) {
    l = max(l, getl(stv[i], 0, pos));
    r = min(r, getr(stv[i], pos, maxr));
    ans = max(ans, (abs(astart - i) + 1) * (max(0, r - l - 1)));
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<SegmentTreeMin> rst(n + 1, SegmentTreeMin(m + 1)),
      cst(m + 1, SegmentTreeMin(n + 1));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int x;
      cin >> x;
      rst[i].modify(j, x);
      cst[j].modify(i, x);
    }
  }
  while (q--) {
    int op, x, y;
    cin >> op >> x >> y;
    if (op == 1) {
      int val = !rst[x].query(y, y + 1);
      rst[x].modify(y, val);
      cst[y].modify(x, val);
    } else {
      int ans = 0;
      ans = max(ans, getAns(rst, x, n + 1, y, m + 1));
      ans = max(ans, getAns(rst, x, 0, y, m + 1));
      ans = max(ans, getAns(cst, y, m + 1, x, n + 1));
      ans = max(ans, getAns(cst, y, 0, x, n + 1));
      cout << ans << '\n';
    }
  }
  return 0;
}
