#include <bits/stdc++.h>
using namespace std;
template <class T>
void dumpBetween(const T& a, const T& b) {
  for (T it = a; it != b; it++) cout << *it << " ";
  cout << endl;
}
template <class T>
void dumpAll(const T& a) {
  dumpBetween((a).begin(), (a).end());
}
template <class T>
void minify(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void maxify(T& a, const T& b) {
  if (a < b) a = b;
}
int n, m, q;
bool a[1008][1008];
int nl[1008][1008];
int nr[1008][1008];
int nu[1008][1008];
int nd[1008][1008];
void readInput() {
  scanf("%d%d%d", &(n), &(m), &(q));
  for (int i = 1; i < ((int)n + 1); i++) {
    for (int j = 1; j < ((int)m + 1); j++) {
      int x;
      scanf("%d", &(x));
      a[i][j] = x;
    }
  }
}
void makeRow(int i) {
  nl[i][1] = a[i][1];
  for (int j = 2; j < ((int)m + 1); j++) {
    nl[i][j] = a[i][j] ? (1 + nl[i][j - 1]) : 0;
  }
  nr[i][m] = a[i][m];
  for (int j = m - 1; j >= 1; j--) {
    nr[i][j] = a[i][j] ? (1 + nr[i][j + 1]) : 0;
  }
}
void makeCol(int c) {
  nu[1][c] = a[1][c];
  for (int j = 2; j < ((int)n + 1); j++) {
    nu[j][c] = a[j][c] ? (1 + nu[j - 1][c]) : 0;
  }
  nd[n][c] = a[n][c];
  for (int j = n - 1; j >= 1; j--) {
    nd[j][c] = a[j][c] ? (1 + nd[j + 1][c]) : 0;
  }
}
void make() {
  for (int i = 1; i < ((int)n + 1); i++) {
    makeRow(i);
  }
  for (int i = 1; i < ((int)m + 1); i++) {
    makeCol(i);
  }
}
void tc() {
  readInput();
  make();
  for (int _98 = 0; _98 < ((int)q); _98++) {
    int qt;
    scanf("%d", &(qt));
    int r, c;
    scanf("%d%d", &(r), &(c));
    if (qt == 1) {
      a[r][c] = !a[r][c];
      makeRow(r);
      makeCol(c);
    } else {
      int best = 0;
      int lf = 1000 << 20, rt = 1000 << 20;
      for (int rr = r; rr <= n; rr++) {
        minify(lf, nl[rr][c]);
        minify(rt, nr[rr][c]);
        if (!(lf && rt)) break;
        maxify(best, (rr - r + 1) * (rt + lf - 1));
      }
      lf = 1000 << 20;
      rt = 1000 << 20;
      for (int rr = r; rr >= 1; rr--) {
        minify(lf, nl[rr][c]);
        minify(rt, nr[rr][c]);
        if (!(lf && rt)) break;
        maxify(best, (r - rr + 1) * (rt + lf - 1));
      }
      lf = 1000 << 20;
      rt = 1000 << 20;
      for (int cc = c; cc <= m; cc++) {
        minify(lf, nu[r][cc]);
        minify(rt, nd[r][cc]);
        if (!(lf && rt)) break;
        maxify(best, (cc - c + 1) * (rt + lf - 1));
      }
      lf = 1000 << 20;
      rt = 1000 << 20;
      for (int cc = c; cc >= 1; cc--) {
        minify(lf, nu[r][cc]);
        minify(rt, nd[r][cc]);
        if (!(lf && rt)) break;
        maxify(best, (c - cc + 1) * (rt + lf - 1));
      }
      printf("%d\n", best);
    }
  }
}
int main() { tc(); }
