#include <bits/stdc++.h>
using namespace std;
class MyClass {
 public:
  int row, col, map[1010][1010];
  int mostL, mostR, ans1, ans2;
  vector<pair<int, int> > sr[1010];
  void reset(int r, int c) { row = r, col = c; }
  void getSegRow(int r) {
    sr[r].clear();
    int flag = 0, st = 0, ed = 0;
    for (int i = 1; i <= col; i++) {
      if (map[r][i]) {
        if (!flag)
          st = ed = i;
        else
          ed = i;
        flag = 1;
      } else {
        if (flag) {
          sr[r].push_back(make_pair(st, ed));
          st = ed = 0;
        }
        flag = 0;
      }
    }
    if (flag) sr[r].push_back(make_pair(st, ed));
  }
  void findUpAndDown(int r, int c) {
    int count;
    ans1 = ans2 = 0, mostL = 0, mostR = col + 1;
    count = find(ans1, c, r, 0, -1);
    mostL = 0, mostR = col + 1;
    count = find(ans2, c, r, row + 1, 1);
  }
  int find(int &ans, int c, int str, int edr, int delta) {
    int cnt = 0;
    for (int r = str; r != edr; r += delta) {
      int index = binary(r, c);
      if (index == -1) break;
      mostL = max(mostL, sr[r][index].first);
      mostR = min(mostR, sr[r][index].second);
      cnt++;
      ans = max(ans, cnt * (mostR - mostL + 1));
    }
    return cnt;
  }
  int binary(int r, int c) {
    int low = 0, high = sr[r].size() - 1, ans = -1;
    while (low <= high) {
      int mid = (low + high) >> 1;
      if (sr[r][mid].first <= c && c <= sr[r][mid].second) {
        return mid;
      }
      if (sr[r][mid].second < c)
        low = mid + 1;
      else if (sr[r][mid].first > c)
        high = mid - 1;
    }
    return ans;
  }
  void showSeg() {
    for (int r = 1; r <= row; r++) {
      printf("sr = %d : ", r);
      for (int i = 0; i < sr[r].size(); i++)
        printf("(%d , %d) ", sr[r][i].first, sr[r][i].second);
      puts("");
    }
  }
  void showMap() {
    puts("--- --- ---");
    for (int i = 1; i <= row; i++)
      for (int j = 1; j <= col; j++)
        printf("%d%c", map[i][j], j == col ? '\n' : ' ');
  }
};
int main() {
  MyClass obj1, obj2;
  int row, col, Q;
  while (scanf("%d%d%d", &row, &col, &Q) != EOF) {
    obj1.reset(row, col);
    obj2.reset(col, row);
    for (int i = 1; i <= row; i++)
      for (int j = 1; j <= col; j++) scanf("%d", &obj1.map[i][j]);
    for (int i = 1; i <= col; i++)
      for (int j = 1; j <= row; j++) obj2.map[i][j] = obj1.map[row - j + 1][i];
    for (int i = 1; i <= obj1.row; i++) obj1.getSegRow(i);
    for (int i = 1; i <= obj2.row; i++) obj2.getSegRow(i);
    while (Q--) {
      int op, r, c;
      scanf("%d%d%d", &op, &r, &c);
      if (op == 1) {
        obj1.map[r][c] = 1 - obj1.map[r][c];
        obj1.getSegRow(r);
        int t = c;
        c = obj1.row - r + 1;
        r = t;
        obj2.map[r][c] = 1 - obj2.map[r][c];
        obj2.getSegRow(r);
      } else {
        int ans = 0;
        obj1.findUpAndDown(r, c);
        ans = max(ans, max(obj1.ans1, obj1.ans2));
        int t = c;
        c = obj1.row - r + 1;
        r = t;
        obj2.findUpAndDown(r, c);
        ans = max(ans, max(obj2.ans1, obj2.ans2));
        printf("%d\n", ans);
      }
    }
  }
  return 0;
}
