#include <bits/stdc++.h>
using namespace std;
const int inv = 1000000000;
const int minv = -inv;
const int max_m = 1010;
const int max_n = 1010;
const int max_q = 1010;
int m, n, q;
int a[max_m][max_n];
int l[max_m][max_n];
int r[max_m][max_n];
int u[max_m][max_n];
int d[max_m][max_n];
void computerow(int i) {
  for (int j = 0; j < n; ++j)
    if (a[i][j] == 0)
      l[i][j] = j + 1;
    else
      l[i][j] = (j == 0 ? 0 : l[i][j - 1]);
  for (int j = n - 1; j > -1; --j)
    if (a[i][j] == 0)
      r[i][j] = j;
    else
      r[i][j] = (j == n - 1 ? n : r[i][j + 1]);
}
void computecol(int j) {
  for (int i = 0; i < m; ++i)
    if (a[i][j] == 0)
      u[i][j] = i + 1;
    else
      u[i][j] = (i == 0 ? 0 : u[i - 1][j]);
  for (int i = m - 1; i > -1; --i)
    if (a[i][j] == 0)
      d[i][j] = i;
    else
      d[i][j] = (i == m - 1 ? m : d[i + 1][j]);
}
bool inside(int i, int j) { return (0 <= i and i < m and 0 <= j and j < n); }
int f(int qi, int qj, int di, int dj, int low[max_m][max_n],
      int high[max_m][max_n]) {
  int i = qi, j = qj;
  int limlow = low[qi][qj], limhigh = high[qi][qj];
  int along = 1;
  int ret = along * (limhigh - limlow);
  while (inside(i + di, j + dj)) {
    i += di;
    j += dj;
    ++along;
    if (low[i][j] > high[i][j]) return ret;
    limlow = max(limlow, low[i][j]);
    limhigh = min(limhigh, high[i][j]);
    ret = max(ret, along * (limhigh - limlow));
  }
  return ret;
}
int main() {
  scanf("%d", &m);
  scanf("%d", &n);
  scanf("%d", &q);
  for (int i = 0; i < m; ++i)
    for (int j = 0; j < n; ++j) scanf("%d", &a[i][j]);
  for (int i = 0; i < m; ++i) computerow(i);
  for (int j = 0; j < n; ++j) computecol(j);
  int t, qi, qj;
  int res;
  for (int z = 0; z < q; ++z) {
    scanf("%d", &t);
    scanf("%d", &qi);
    scanf("%d", &qj);
    --qi;
    --qj;
    if (t == 1) {
      a[qi][qj] = 1 - a[qi][qj];
      computerow(qi);
      computecol(qj);
    } else {
      if (a[qi][qj] == 0)
        printf("%d\n", 0);
      else {
        res = f(qi, qj, 0, -1, u, d);
        res = max(res, f(qi, qj, 0, 1, u, d));
        res = max(res, f(qi, qj, -1, 0, l, r));
        res = max(res, f(qi, qj, 1, 0, l, r));
        printf("%d\n", res);
      }
    }
  }
  return 0;
}
