#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
int a[1002][1002];
int L[1002][1002], R[1002][1002], U[1002][1002], D[1002][1002];
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int(i) = (1); (i) <= (n); (i) += (1))
    for (int(j) = (1); (j) <= (m); (j) += (1)) scanf("%d", a[i] + j);
  for (int(i) = (1); (i) <= (n); (i) += (1)) {
    for (int(j) = (1); (j) <= (m); (j) += (1))
      if (a[i][j]) L[i][j] = L[i][j - 1] + 1;
    for (int(j) = (m); (j) >= (1); (j) -= (1))
      if (a[i][j]) R[i][j] = R[i][j + 1] + 1;
  }
  for (int(j) = (1); (j) <= (m); (j) += (1)) {
    for (int(i) = (1); (i) <= (n); (i) += (1))
      if (a[i][j]) U[i][j] = U[i - 1][j] + 1;
    for (int(i) = (n); (i) >= (1); (i) -= (1))
      if (a[i][j]) D[i][j] = D[i + 1][j] + 1;
  }
  while (q--) {
    int o, x, y;
    scanf("%d%d%d", &o, &x, &y);
    if (o == 1) {
      a[x][y] ^= 1;
      for (int(j) = (1); (j) <= (m); (j) += (1)) {
        if (a[x][j])
          L[x][j] = L[x][j - 1] + 1;
        else
          L[x][j] = 0;
      }
      for (int(j) = (m); (j) >= (1); (j) -= (1)) {
        if (a[x][j])
          R[x][j] = R[x][j + 1] + 1;
        else
          R[x][j] = 0;
      }
      for (int(i) = (1); (i) <= (n); (i) += (1)) {
        if (a[i][y])
          U[i][y] = U[i - 1][y] + 1;
        else
          U[i][y] = 0;
      }
      for (int(i) = (n); (i) >= (1); (i) -= (1)) {
        if (a[i][y])
          D[i][y] = D[i + 1][y] + 1;
        else
          D[i][y] = 0;
      }
    } else {
      if (a[x][y] == 0) {
        puts("0");
        continue;
      }
      int l = y, r = y;
      int ans = -1;
      int tmp = U[x][y], h = tmp;
      while (1) {
        if (U[x][l - 1] == 0 && U[x][r + 1] == 0) break;
        if (U[x][l - 1] > U[x][r + 1]) {
          h = min(h, U[x][l - 1]);
          l--;
        } else {
          h = min(h, U[x][r + 1]);
          r++;
        }
        tmp = max(tmp, (r - l + 1) * h);
      }
      ans = max(ans, tmp);
      l = y, r = y;
      tmp = D[x][y], h = tmp;
      while (1) {
        if (D[x][l - 1] == 0 && D[x][r + 1] == 0) break;
        if (D[x][l - 1] > D[x][r + 1]) {
          h = min(h, D[x][l - 1]);
          l--;
        } else {
          h = min(h, D[x][r + 1]);
          r++;
        }
        tmp = max(tmp, (r - l + 1) * h);
      }
      ans = max(ans, tmp);
      l = x, r = x;
      tmp = L[x][y], h = tmp;
      while (1) {
        if (L[l - 1][y] == 0 && L[r + 1][y] == 0) break;
        if (L[l - 1][y] > L[r + 1][y]) {
          h = min(h, L[l - 1][y]);
          l--;
        } else {
          h = min(h, L[r + 1][y]);
          r++;
        }
        tmp = max(tmp, (r - l + 1) * h);
      }
      ans = max(ans, tmp);
      l = x, r = x;
      tmp = R[x][y], h = tmp;
      while (1) {
        if (R[l - 1][y] == 0 && R[r + 1][y] == 0) break;
        if (R[l - 1][y] > R[r + 1][y]) {
          h = min(h, R[l - 1][y]);
          l--;
        } else {
          h = min(h, R[r + 1][y]);
          r++;
        }
        tmp = max(tmp, (r - l + 1) * h);
      }
      ans = max(ans, tmp);
      printf("%d\n", ans);
    }
  }
}
