#include <bits/stdc++.h>
using namespace std;
const int maxn = 1100;
int n, m, Q;
int a[maxn][maxn];
int l[maxn][maxn], r[maxn][maxn], u[maxn][maxn], d[maxn][maxn];
int hehe[maxn], haha[maxn];
int Solve(int arr[], int p, int q) {
  int L = p, R = p;
  int tmp = -1;
  for (int i = arr[p]; i >= 1; i--) {
    while (L >= 1 && arr[L] >= i) L--;
    while (R <= q && arr[R] >= i) R++;
    int t = (R - L - 1) * i;
    tmp = max(tmp, t);
  }
  return tmp;
}
int main() {
  cin >> n >> m >> Q;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == 1)
        l[i][j] = l[i][j - 1] + 1;
      else
        l[i][j] = 0;
    }
    for (int j = m; j >= 1; j--) {
      if (a[i][j] == 1)
        r[i][j] = r[i][j + 1] + 1;
      else
        r[i][j] = 0;
    }
  }
  for (int j = 1; j <= m; j++) {
    for (int i = 1; i <= n; i++) {
      if (a[i][j] == 1)
        u[i][j] = u[i - 1][j] + 1;
      else
        u[i][j] = 0;
    }
    for (int i = n; i >= 1; i--) {
      if (a[i][j] == 1)
        d[i][j] = d[i + 1][j] + 1;
      else
        d[i][j] = 0;
    }
  }
  while (Q--) {
    int ope, x, y;
    scanf("%d%d%d", &ope, &x, &y);
    if (ope == 1) {
      a[x][y] ^= 1;
      for (int j = 1; j <= m; j++) {
        if (a[x][j] == 1)
          l[x][j] = l[x][j - 1] + 1;
        else
          l[x][j] = 0;
      }
      for (int j = m; j >= 1; j--) {
        if (a[x][j] == 1)
          r[x][j] = r[x][j + 1] + 1;
        else
          r[x][j] = 0;
      }
      for (int i = 1; i <= n; i++) {
        if (a[i][y] == 1)
          u[i][y] = u[i - 1][y] + 1;
        else
          u[i][y] = 0;
      }
      for (int i = n; i >= 1; i--) {
        if (a[i][y] == 1)
          d[i][y] = d[i + 1][y] + 1;
        else
          d[i][y] = 0;
      }
    } else {
      if (a[x][y] == 0) {
        cout << "0" << endl;
        continue;
      }
      for (int i = 1; i <= n; i++) {
        hehe[i] = l[i][y];
        haha[i] = r[i][y];
      }
      int t1 = Solve(hehe, x, n);
      int t2 = Solve(haha, x, n);
      for (int j = 1; j <= m; j++) {
        hehe[j] = u[x][j];
        haha[j] = d[x][j];
      }
      int t3 = Solve(hehe, y, m);
      int t4 = Solve(haha, y, m);
      printf("%d\n", max(max(t1, t2), max(t3, t4)));
    }
  }
  return 0;
}
