#include <bits/stdc++.h>
using namespace std;
int br[2048][2048], bc[2048][2048], a[2048][2048];
void update(int *bit, int x, int v) {
  for (x += 5; x < 2048; x += (x & -x)) bit[x] += v;
}
int query(int *bit, int x) {
  int ret = 0;
  for (x += 5; x; x -= (x & -x)) ret += bit[x];
  return ret;
}
int query(int *bit, int lo, int hi) {
  int ret = query(bit, hi);
  ret -= query(bit, lo - 1);
  return ret;
}
int solve(vector<int> p, int x) {
  int lx = x - 1, rx = x + 1;
  int minh = p[x], ans = p[x], w = 1;
  while (lx >= 0 || rx < p.size()) {
    if (lx < 0) {
      minh = min(minh, p[rx]);
      rx++;
    } else if (rx >= p.size()) {
      minh = min(minh, p[lx]);
      lx--;
    } else {
      if (p[rx] >= p[lx]) {
        minh = min(minh, p[rx]);
        rx++;
      } else {
        minh = min(minh, p[lx]);
        lx--;
      }
    }
    w++;
    ans = max(ans, minh * w);
  }
  return ans;
}
int main() {
  int n, m, q;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &q);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &a[i][j]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] == 0) update(br[i], j, 1), update(bc[j], i, 1);
  while (q--) {
    int ty;
    scanf("%d", &ty);
    if (ty == 1) {
      int i, j;
      scanf("%d", &i);
      scanf("%d", &j);
      i--;
      j--;
      if (a[i][j] == 0) update(br[i], j, -1), update(bc[j], i, -1);
      a[i][j] = 1 - a[i][j];
      if (a[i][j] == 0) update(br[i], j, 1), update(bc[j], i, 1);
    } else {
      int i, j;
      scanf("%d", &i);
      scanf("%d", &j);
      i--;
      j--;
      if (a[i][j] == 0) {
        printf("0\n");
        continue;
      }
      vector<int> p(m, 0);
      for (int k = 0; k < p.size(); k++) {
        int ans = 0, add = 1024, temp;
        while (add) {
          temp = ans + add;
          add >>= 1;
          if (i + temp > n) continue;
          if (query(bc[k], i, i + temp - 1) == 0) ans = temp;
        }
        p[k] = ans;
      }
      int mainans = solve(p, j);
      for (int k = 0; k < p.size(); k++) {
        int ans = 0, add = 1024, temp;
        while (add) {
          temp = ans + add;
          add >>= 1;
          if (i - temp + 1 < 0) continue;
          if (query(bc[k], i - temp + 1, i) == 0) ans = temp;
        }
        p[k] = ans;
      }
      mainans = max(solve(p, j), mainans);
      p.resize(n);
      for (int k = 0; k < p.size(); k++) {
        int ans = 0, add = 1024, temp;
        while (add) {
          temp = ans + add;
          add >>= 1;
          if (j + temp > m) continue;
          if (query(br[k], j, j + temp - 1) == 0) ans = temp;
        }
        p[k] = ans;
      }
      mainans = max(solve(p, i), mainans);
      for (int k = 0; k < p.size(); k++) {
        int ans = 0, add = 1024, temp;
        while (add) {
          temp = ans + add;
          add >>= 1;
          if (j - temp + 1 < 0) continue;
          if (query(br[k], j - temp + 1, j) == 0) ans = temp;
        }
        p[k] = ans;
      }
      mainans = max(solve(p, i), mainans);
      cout << mainans << endl;
    }
  }
}
