#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int INF = 2123123123;
const int MOD = 1e9 + 7;
inline void OPEN(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
int n, m, q;
int ar[1000 + 5][1000 + 5], up[1000 + 5][1000 + 5], down[1000 + 5][1000 + 5],
    lf[1000 + 5][1000 + 5], rf[1000 + 5][1000 + 5];
int idx[1000 + 5], calc[1000 + 5];
bool cmp(int a, int b) { return calc[a] > calc[b]; }
struct DS {
  int f[1000 + 5];
  void init(int n) {
    for (int i = 0; i <= n; i++) f[i] = i;
  }
  int find(int x) {
    if (x < 0) return -1;
    return (f[x] == x) ? x : f[x] = find(f[x]);
  }
  void merge(int x, int y) { f[find(x)] = find(y); }
} lds, rds;
int solve(int n, int pivot) {
  int ret = 0;
  for (int i = 0; i < n; i++) idx[i] = i;
  sort(idx, idx + n, cmp);
  lds.init(n);
  rds.init(n);
  for (int i = 0; i < n; i++) {
    int l = lds.find(idx[i] - 1) + 1;
    int r = rds.find(idx[i] + 1) - 1;
    if (l <= pivot && pivot <= r) ret = max(ret, (r - l + 1) * calc[idx[i]]);
    lds.merge(idx[i], idx[i] - 1);
    rds.merge(idx[i], idx[i] + 1);
  }
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &ar[i][j]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (ar[i][j]) {
        up[i][j] = up[i - 1][j] + 1;
        lf[i][j] = lf[i][j - 1] + 1;
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      if (ar[i][j]) {
        down[i][j] = down[i + 1][j] + 1;
        rf[i][j] = rf[i][j + 1] + 1;
      }
    }
  }
  for (int i = 0; i < q; i++) {
    int type, r, c;
    scanf("%d", &type);
    scanf("%d%d", &r, &c);
    --r;
    --c;
    if (type == 1) {
      ar[r][c] ^= 1;
      for (int i = 0; i < n; i++) {
        if (!ar[i][c])
          up[i][c] = 0;
        else
          up[i][c] = up[i - 1][c] + 1;
      }
      for (int i = n - 1; i >= 0; i--) {
        if (!ar[i][c])
          down[i][c] = 0;
        else
          down[i][c] = down[i + 1][c] + 1;
      }
      for (int i = 0; i < m; i++) {
        if (!ar[r][i])
          lf[r][i] = 0;
        else
          lf[r][i] = lf[r][i - 1] + 1;
      }
      for (int i = m - 1; i >= 0; i--) {
        if (!ar[r][i])
          rf[r][i] = 0;
        else
          rf[r][i] = rf[r][i + 1] + 1;
      }
    } else {
      int ans = 0;
      for (int i = 0; i < m; i++) calc[i] = up[r][i];
      ans = max((ans), (solve(m, c)));
      ;
      for (int i = 0; i < m; i++) calc[i] = down[r][i];
      ans = max((ans), (solve(m, c)));
      ;
      for (int i = 0; i < n; i++) calc[i] = lf[i][c];
      ans = max((ans), (solve(n, r)));
      ;
      for (int i = 0; i < n; i++) calc[i] = rf[i][c];
      ans = max((ans), (solve(n, r)));
      ;
      printf("%d\n", ans);
    }
  }
  return 0;
}
