#include <bits/stdc++.h>
using namespace std;
int vals[1005][1005];
int l[1005][1005];
int r[1005][1005];
int n, m, q;
inline void make(int i) {
  for (int j = 1; j <= m; j++)
    if (vals[i][j] == 1)
      if (vals[i][j - 1] == 1)
        l[i][j] = l[i][j - 1];
      else
        l[i][j] = j;
    else
      l[i][j] = 100000;
  for (int j = m; j >= 1; j--)
    if (vals[i][j] == 1)
      if (vals[i][j + 1] == 1)
        r[i][j] = r[i][j + 1];
      else
        r[i][j] = j;
    else
      r[i][j] = -100000;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &vals[i][j]);
  for (int i = 1; i <= n; i++) make(i);
  while (q--) {
    int op, x, y;
    scanf("%d%d%d", &op, &x, &y);
    if (op == 1) {
      vals[x][y] ^= 1;
      make(x);
    } else {
      if (vals[x][y] == 0) {
        printf("0\n");
        continue;
      }
      int sol = 0;
      int p, k;
      p = k = x;
      for (int i = l[x][y]; i <= y; i++) {
        while (p > 1 && l[p - 1][y] <= i) p--;
        while (k < n && l[k + 1][y] <= i) k++;
        sol = max(sol, (y - i + 1) * (k - p + 1));
      }
      p = k = x;
      for (int i = r[x][y]; i >= y; i--) {
        while (p > 1 && r[p - 1][y] >= i) p--;
        while (k < n && r[k + 1][y] >= i) k++;
        sol = max(sol, (i - y + 1) * (k - p + 1));
      }
      p = -10000;
      k = 10000;
      for (int i = x; i >= 1; i--) {
        p = max(p, l[i][y]);
        k = min(k, r[i][y]);
        if (p > k) break;
        sol = max(sol, (x - i + 1) * (k - p + 1));
      }
      p = -10000;
      k = 10000;
      for (int i = x; i <= n; i++) {
        p = max(p, l[i][y]);
        k = min(k, r[i][y]);
        if (p > k) break;
        sol = max(sol, (i - x + 1) * (k - p + 1));
      }
      printf("%d\n", sol);
    }
  }
}
