#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void get(T &n) {
  char c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  n = 0;
  T s = 1;
  if (c == '-') s = -1, c = getchar();
  while (c >= '0' && c <= '9') n *= 10, n += c - '0', c = getchar();
  n *= s;
}
const int maxn = 1010;
int n, m, q, a[maxn][maxn];
int u[maxn][maxn], d[maxn][maxn], l[maxn][maxn], r[maxn][maxn];
int main() {
  int i, j, k, t, tt;
  get(n);
  get(m);
  get(q);
  for (i = (1); i <= (n); i++)
    for (j = (1); j <= (m); j++) get(a[i][j]);
  for (i = (1); i <= (n); i++)
    for (j = (1); j <= (m); j++) {
      u[i][j] = a[i][j] ? u[i - 1][j] + 1 : 0;
      l[i][j] = a[i][j] ? l[i][j - 1] + 1 : 0;
    }
  for (i = (n); i >= (1); i--)
    for (j = (m); j >= (1); j--) {
      d[i][j] = a[i][j] ? d[i + 1][j] + 1 : 0;
      r[i][j] = a[i][j] ? r[i][j + 1] + 1 : 0;
    }
  while (q--) {
    int x, y;
    get(k);
    get(x);
    get(y);
    if (k == 1) {
      a[x][y] ^= 1;
      for (i = (x); i <= (n); i++) u[i][y] = a[i][y] ? u[i - 1][y] + 1 : 0;
      for (j = (y); j <= (m); j++) l[x][j] = a[x][j] ? l[x][j - 1] + 1 : 0;
      for (i = (x); i >= (1); i--) d[i][y] = a[i][y] ? d[i + 1][y] + 1 : 0;
      for (j = (y); j >= (1); j--) r[x][j] = a[x][j] ? r[x][j + 1] + 1 : 0;
    } else {
      t = 0;
      i = j = y;
      for (k = (u[x][y]); k >= (1); k--) {
        for (; i > 1 && u[x][i - 1] >= k; i--)
          ;
        for (; j < m && u[x][j + 1] >= k; j++)
          ;
        t = max(t, k * (j - i + 1));
      }
      i = j = y;
      for (k = (d[x][y]); k >= (1); k--) {
        for (; i > 1 && d[x][i - 1] >= k; i--)
          ;
        for (; j < m && d[x][j + 1] >= k; j++)
          ;
        t = max(t, k * (j - i + 1));
      }
      i = j = x;
      for (k = (l[x][y]); k >= (1); k--) {
        for (; i > 1 && l[i - 1][y] >= k; i--)
          ;
        for (; j < n && l[j + 1][y] >= k; j++)
          ;
        t = max(t, k * (j - i + 1));
      }
      i = j = x;
      for (k = (r[x][y]); k >= (1); k--) {
        for (; i > 1 && r[i - 1][y] >= k; i--)
          ;
        for (; j < n && r[j + 1][y] >= k; j++)
          ;
        t = max(t, k * (j - i + 1));
      }
      printf("%d\n", t);
    }
  }
  return 0;
}
