#include <bits/stdc++.h>
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std;
struct BIT {
  int a[1113 + 10];
  BIT() { memset(a, 0, sizeof a); }
  int getsum(int r) {
    int ret = 0;
    while (r > 0) {
      ret += a[r];
      r -= r & (-r);
    }
    return ret;
  }
  int getsum(int l, int r) { return getsum(r) - getsum(l - 1); }
  void add(int ad, int l) {
    while (l < 1113) {
      a[l] += ad;
      l += l & (-l);
    }
  }
} bit[1113 * 2];
pair<int, int> query(int id, int j) {
  int l = 0, r = j;
  while (l < r) {
    int mid = (r + l + 1) / 2;
    if (bit[id].getsum(j - mid + 1, j) == mid)
      l = mid;
    else
      r = mid - 1;
  }
  int l1 = l;
  l = 0;
  r = 1113 - j;
  while (l < r) {
    int mid = (r + l + 1) / 2;
    if (bit[id].getsum(j, j + mid - 1) == mid)
      l = mid;
    else
      r = mid - 1;
  }
  int l2 = l;
  if (l1 == 0 || l2 == 0) l1 = l2 = 0;
  return make_pair(l1, l2);
}
int n, m, Q;
int a[1113][1113];
pair<int, int> min1(pair<int, int> x, pair<int, int> y) {
  return make_pair(min(x.first, y.first), min(x.second, y.second));
}
int main() {
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &Q);
  for (int i = 1; i <= (n); i++)
    for (int j = 1; j <= (m); j++) {
      scanf("%d", &a[i][j]);
      if (a[i][j] == 1) {
        bit[i].add(1, j);
        bit[j + n].add(1, i);
      }
    }
  for (int _Q = 0; _Q < (Q); _Q++) {
    int op, x, y;
    scanf("%d", &op);
    scanf("%d", &x);
    scanf("%d", &y);
    if (op == 1) {
      a[x][y] = 1 - a[x][y];
      int ad = (a[x][y] > 0) ? 1 : -1;
      bit[x].add(ad, y);
      bit[y + n].add(ad, x);
    } else {
      int ans = 0;
      pair<int, int> len = query(x, y);
      for (int i = x; i > 0; i--) {
        len = min1(len, query(i, y));
        if (len.first == 0 || len.second == 0) break;
        ans = max(ans, (len.first + len.second - 1) * (x - i + 1));
      }
      len = query(x, y);
      for (int i = x; i <= n; i++) {
        len = min1(len, query(i, y));
        if (len.first == 0 || len.second == 0) break;
        ans = max(ans, (len.first + len.second - 1) * (i - x + 1));
      }
      len = query(y + n, x);
      for (int i = y; i > 0; i--) {
        len = min1(len, query(i + n, x));
        if (len.first == 0 || len.second == 0) break;
        ans = max(ans, (len.first + len.second - 1) * (y - i + 1));
      }
      len = query(y + n, x);
      for (int i = y; i <= m; i++) {
        len = min1(len, query(i + n, x));
        if (len.first == 0 || len.second == 0) break;
        ans = max(ans, (len.first + len.second - 1) * (i - y + 1));
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
