#include <bits/stdc++.h>
using namespace std;
const int maxn = 1100;
int grid[maxn][maxn];
int T[maxn][maxn], B[maxn][maxn];
int L[maxn][maxn], R[maxn][maxn];
char buf[maxn * 10];
int main() {
  int n, m, q, i, j, tp, u, v, po;
  scanf("%d%d%d ", &n, &m, &q);
  for (i = 0; i < n; i++) {
    scanf(" ");
    gets(buf);
    for (j = 0; j < m; j++) grid[i][j] = buf[2 * j] - '0';
  }
  for (i = 0; i < n; i++) {
    po = -1;
    for (j = 0; j < m; j++) {
      if (po == -1 && grid[i][j] == 1) po = j;
      if (grid[i][j] == 0) po = -1;
      L[i][j] = po;
    }
    po = m;
    for (j = m - 1; j >= 0; j--) {
      if (po == m && grid[i][j] == 1) po = j;
      if (grid[i][j] == 0) po = m;
      R[i][j] = po;
    }
  }
  for (i = 0; i < m; i++) {
    po = -1;
    for (j = 0; j < n; j++) {
      if (po == -1 && grid[j][i] == 1) po = j;
      if (grid[j][i] == 0) po = -1;
      T[j][i] = po;
    }
    po = n;
    for (j = n - 1; j >= 0; j--) {
      if (po == n && grid[j][i] == 1) po = j;
      if (grid[j][i] == 0) po = n;
      B[j][i] = po;
    }
  }
  while (q--) {
    scanf("%d%d%d", &tp, &u, &v);
    u--;
    v--;
    if (tp == 1) {
      grid[u][v] ^= 1;
      po = -1;
      for (j = 0; j < m; j++) {
        if (po == -1 && grid[u][j] == 1) po = j;
        if (grid[u][j] == 0) po = -1;
        L[u][j] = po;
      }
      po = m;
      for (j = m - 1; j >= 0; j--) {
        if (po == m && grid[u][j] == 1) po = j;
        if (grid[u][j] == 0) po = m;
        R[u][j] = po;
      }
      po = -1;
      for (j = 0; j < n; j++) {
        if (po == -1 && grid[j][v] == 1) po = j;
        if (grid[j][v] == 0) po = -1;
        T[j][v] = po;
      }
      po = n;
      for (j = n - 1; j >= 0; j--) {
        if (po == n && grid[j][v] == 1) po = j;
        if (grid[j][v] == 0) po = n;
        B[j][v] = po;
      }
    } else {
      if (grid[u][v] == 0) {
        puts("0");
        continue;
      }
      int ans = 0;
      int t = T[u][v], b = B[u][v];
      for (i = v; i < m; i++) {
        if (grid[u][i] == 0) break;
        t = max(t, T[u][i]);
        b = min(b, B[u][i]);
        ans = max(ans, (i - v + 1) * (b - t + 1));
      }
      t = T[u][v], b = B[u][v];
      for (i = v; i >= 0; i--) {
        if (grid[u][i] == 0) break;
        t = max(t, T[u][i]);
        b = min(b, B[u][i]);
        ans = max(ans, (v + 1 - i) * (b - t + 1));
      }
      t = L[u][v], b = R[u][v];
      for (i = u; i < n; i++) {
        if (grid[i][v] == 0) break;
        t = max(t, L[i][v]);
        b = min(b, R[i][v]);
        ans = max(ans, (i - u + 1) * (b - t + 1));
      }
      t = L[u][v], b = R[u][v];
      for (i = u; i >= 0; i--) {
        if (grid[i][v] == 0) break;
        t = max(t, L[i][v]);
        b = min(b, R[i][v]);
        ans = max(ans, (u - i + 1) * (b - t + 1));
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
