#include <bits/stdc++.h>
using namespace std;
int pic[1005][1005];
int sl[1005][1005], sr[1005][1005], su[1005][1005], sd[1005][1005];
int n, m, Q, q;
void updatex(int x) {
  int cnt = 0, j;
  for (j = 1; j <= m; j++) {
    if (pic[x][j])
      sl[x][j] = ++cnt;
    else
      sl[x][j] = cnt = 0;
  }
  cnt = 0;
  for (j = m; j >= 1; j--) {
    if (pic[x][j])
      sr[x][j] = ++cnt;
    else
      sr[x][j] = cnt = 0;
  }
}
void updatey(int y) {
  int cnt = 0, j;
  for (j = 1; j <= n; j++) {
    if (pic[j][y])
      su[j][y] = ++cnt;
    else
      su[j][y] = cnt = 0;
  }
  cnt = 0;
  for (j = n; j >= 1; j--) {
    if (pic[j][y])
      sd[j][y] = ++cnt;
    else
      sd[j][y] = cnt = 0;
  }
}
int rect(vector<int> &v, int x) {
  int fr = x - 1, bk = x + 1;
  int t = v[x];
  if (t == 0) return 0;
  int ret = t;
  while (!(v[fr] == 0 && v[bk] == 0)) {
    if (v[fr] > v[bk]) {
      t = min(v[fr], t);
      fr--;
      ret = max(ret, t * (bk - fr - 1));
    } else {
      t = min(v[bk], t);
      bk++;
      ret = max(ret, t * (bk - fr - 1));
    }
  }
  return ret;
}
int main() {
  scanf("%d %d %d", &n, &m, &Q);
  int i, j;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf("%d", &pic[i][j]);
  for (i = 1; i <= n; i++) updatex(i);
  for (i = 1; i <= m; i++) updatey(i);
  for (q = 0; q < Q; q++) {
    int x, y, op;
    scanf("%d %d %d", &op, &x, &y);
    if (op == 1) {
      pic[x][y] = 1 - pic[x][y];
      updatex(x);
      updatey(y);
    } else {
      int ans = 0;
      vector<int> v;
      v.push_back(0);
      for (i = 1; i <= n; i++) v.push_back(sl[i][y]);
      v.push_back(0);
      int tp = rect(v, x);
      v.clear();
      ans = max(ans, tp);
      v.push_back(0);
      for (i = 1; i <= n; i++) v.push_back(sr[i][y]);
      v.push_back(0);
      tp = rect(v, x);
      v.clear();
      ans = max(ans, tp);
      v.push_back(0);
      for (i = 1; i <= m; i++) v.push_back(su[x][i]);
      v.push_back(0);
      tp = rect(v, y);
      v.clear();
      ans = max(ans, tp);
      v.push_back(0);
      for (i = 1; i <= m; i++) v.push_back(sd[x][i]);
      v.push_back(0);
      tp = rect(v, y);
      v.clear();
      ans = max(ans, tp);
      printf("%d\n", ans);
    }
  }
}
