#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,1024000")
using namespace std;
int st[4][1010][1010];
int Map[1010][1010];
int jx[] = {0, -1, 0, 1};
int jy[] = {-1, 0, 1, 0};
int main() {
  int n, m, q;
  int o, x, y;
  memset(Map, 0, sizeof(Map));
  memset(st, 0, sizeof(st));
  scanf("%d %d %d", &n, &m, &q);
  int i, j, k;
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) scanf("%d", &Map[i][j]);
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j)
      for (k = 0; k < 2; ++k)
        st[k][i][j] = Map[i][j] * (Map[i][j] + st[k][i + jx[k]][j + jy[k]]);
  for (i = n; i >= 1; --i)
    for (j = m; j >= 1; --j)
      for (k = 2; k < 4; ++k)
        st[k][i][j] = Map[i][j] * (Map[i][j] + st[k][i + jx[k]][j + jy[k]]);
  while (q--) {
    scanf("%d %d %d", &o, &x, &y);
    if (o == 1) {
      Map[x][y] ^= 1;
      for (i = y; i <= m; ++i)
        st[0][x][i] = Map[x][i] * (Map[x][i] + st[0][x][i - 1]);
      for (i = y; i >= 1; --i)
        st[2][x][i] = Map[x][i] * (Map[x][i] + st[2][x][i + 1]);
      for (i = x; i <= n; ++i)
        st[1][i][y] = Map[i][y] * (Map[i][y] + st[1][i - 1][y]);
      for (i = x; i >= 1; --i)
        st[3][i][y] = Map[i][y] * (Map[i][y] + st[3][i + 1][y]);
    } else {
      if (Map[x][y] == 0) {
        printf("0\n");
        continue;
      }
      int Max, L, R, H;
      Max = 0, L = y, R = y, H = st[1][x][y];
      while (Map[x][L] && Map[x][R]) {
        Max = max(Max, (R - L + 1) * H);
        if (st[1][x][L - 1] >= st[1][x][R + 1])
          L--, H = min(H, st[1][x][L]);
        else
          R++, H = min(H, st[1][x][R]);
      }
      L = y, R = y, H = st[3][x][y];
      while (Map[x][L] && Map[x][R]) {
        Max = max(Max, (R - L + 1) * H);
        if (st[3][x][L - 1] >= st[3][x][R + 1])
          L--, H = min(H, st[3][x][L]);
        else
          R++, H = min(H, st[3][x][R]);
      }
      int U, D, W;
      U = x, D = x, W = st[0][x][y];
      while (Map[U][y] && Map[D][y]) {
        Max = max(Max, (D - U + 1) * W);
        if (st[0][U - 1][y] >= st[0][D + 1][y])
          U--, W = min(W, st[0][U][y]);
        else
          D++, W = min(W, st[0][D][y]);
      }
      U = x, D = x, W = st[2][x][y];
      while (Map[U][y] && Map[D][y]) {
        Max = max(Max, (D - U + 1) * W);
        if (st[2][U - 1][y] >= st[2][D + 1][y])
          U--, W = min(W, st[2][U][y]);
        else
          D++, W = min(W, st[2][D][y]);
      }
      printf("%d\n", Max);
    }
  }
  return 0;
}
