#include <bits/stdc++.h>
int a[1005][1005];
int left[1005][1005], right[1005][1005], up[1005][1005], down[1005][1005];
int n, m, q;
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
void update(int x, int y) {
  int i, j;
  for (j = 1; j <= m; j++)
    if (a[x][j])
      left[x][j] = left[x][j - 1] + 1;
    else
      left[x][j] = 0;
  for (j = m; j >= 1; j--)
    if (a[x][j])
      right[x][j] = right[x][j + 1] + 1;
    else
      right[x][j] = 0;
  for (i = 1; i <= n; i++)
    if (a[i][y])
      up[i][y] = up[i - 1][y] + 1;
    else
      up[i][y] = 0;
  for (i = n; i >= 1; i--)
    if (a[i][y])
      down[i][y] = down[i + 1][y] + 1;
    else
      down[i][y] = 0;
}
void work(int x, int y) {
  if (a[x][y] == 0) {
    printf("0\n");
    return;
  }
  int ans = 0, i;
  int U = 1e9, D = 1e9, L = 1e9, R = 1e9;
  for (i = y; i >= 1; i--) {
    U = min(U, up[x][i]);
    D = min(D, down[x][i]);
    ans = max(ans, (U + D - 1) * (y - i + 1));
  }
  U = 1e9, D = 1e9;
  for (i = y; i <= m; i++) {
    U = min(U, up[x][i]);
    D = min(D, down[x][i]);
    ans = max(ans, (U + D - 1) * (i - y + 1));
  }
  for (i = x; i >= 1; i--) {
    L = min(L, left[i][y]);
    R = min(R, right[i][y]);
    ans = max(ans, (L + R - 1) * (x - i + 1));
  }
  L = 1e9, R = 1e9;
  for (i = x; i <= n; i++) {
    L = min(L, left[i][y]);
    R = min(R, right[i][y]);
    ans = max(ans, (L + R - 1) * (i - x + 1));
  }
  printf("%d\n", ans);
}
int main() {
  while (~scanf("%d%d%d", &n, &m, &q)) {
    int i, j;
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) {
        scanf("%d", &a[i][j]);
      }
    for (i = 1; i <= n; i++) {
      left[i][0] = left[i][m + 1] = 0;
      for (j = 1; j <= m; j++)
        if (a[i][j])
          left[i][j] = left[i][j - 1] + 1;
        else
          left[i][j] = 0;
      right[i][0] = right[i][m + 1] = 0;
      for (j = m; j >= 1; j--)
        if (a[i][j])
          right[i][j] = right[i][j + 1] + 1;
        else
          right[i][j] = 0;
    }
    for (j = 1; j <= m; j++) {
      up[0][j] = up[n + 1][j] = 0;
      for (i = 1; i <= n; i++)
        if (a[i][j])
          up[i][j] = up[i - 1][j] + 1;
        else
          up[i][j] = 0;
      down[0][j] = down[n + 1][j] = 0;
      for (i = n; i >= 1; i--)
        if (a[i][j])
          down[i][j] = down[i + 1][j] + 1;
        else
          down[i][j] = 0;
    }
    for (i = 0; i < q; i++) {
      int op, x, y;
      scanf("%d%d%d", &op, &x, &y);
      if (op == 1) {
        a[x][y] = 1 - a[x][y];
        update(x, y);
      } else {
        work(x, y);
      }
    }
  }
  return 0;
}
