#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double EPS = 1e-6;
enum { LEFT = 0, UP = 1, RIGHT = 2, DOWN = 3 };
int a[1005][1005];
int dp[4][1005][1005];
int n, m, q;
void setup(int dir, int pos) {
  switch (dir) {
    case LEFT:
      for (int c = 1; c <= m; c++) {
        dp[dir][pos][c] = dp[dir][pos][c - 1] + 1;
        if (a[pos][c] == 0) dp[dir][pos][c] = 0;
      }
      break;
    case UP:
      for (int r = 1; r <= n; r++) {
        dp[dir][r][pos] = dp[dir][r - 1][pos] + 1;
        if (a[r][pos] == 0) dp[dir][r][pos] = 0;
      }
      break;
    case RIGHT:
      for (int c = m; c >= 1; c--) {
        dp[dir][pos][c] = dp[dir][pos][c + 1] + 1;
        if (a[pos][c] == 0) dp[dir][pos][c] = 0;
      }
      break;
    case DOWN:
      for (int r = n; r >= 1; r--) {
        dp[dir][r][pos] = dp[dir][r + 1][pos] + 1;
        if (a[r][pos] == 0) dp[dir][r][pos] = 0;
      }
      break;
  }
}
int get_light_block(int dir, int x, int y) {
  int maxx = dp[dir][x][y];
  int px1 = x, px2 = x, py1 = y, py2 = y;
  int res = 0;
  switch (dir) {
    case LEFT:
    case RIGHT:
      while (maxx > 0) {
        while (dp[dir][px1 - 1][y] >= maxx) px1--;
        while (dp[dir][px2 + 1][y] >= maxx) px2++;
        res = max(res, maxx * (px2 - px1 + 1));
        maxx = max(dp[dir][px1 - 1][y], dp[dir][px2 + 1][y]);
      }
      break;
    case UP:
    case DOWN:
      while (maxx > 0) {
        while (dp[dir][x][py1 - 1] >= maxx) py1--;
        while (dp[dir][x][py2 + 1] >= maxx) py2++;
        res = max(res, maxx * (py2 - py1 + 1));
        maxx = max(dp[dir][x][py1 - 1], dp[dir][x][py2 + 1]);
      }
      break;
  }
  return res;
}
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int r = 1; r <= n; r++)
    for (int c = 1; c <= m; c++) scanf("%d", a[r] + c);
  for (int r = 1; r <= n; r++) {
    setup(LEFT, r);
    setup(RIGHT, r);
  }
  for (int c = 1; c <= m; c++) {
    setup(UP, c);
    setup(DOWN, c);
  }
  while (q--) {
    int op, x, y;
    scanf("%d %d %d", &op, &x, &y);
    if (op == 1) {
      a[x][y] ^= 1;
      setup(LEFT, x);
      setup(UP, y);
      setup(RIGHT, x);
      setup(DOWN, y);
    } else {
      int res = 0;
      for (int k = 0; k < 4; k++) res = max(res, get_light_block(k, x, y));
      printf("%d\n", res);
    }
  }
  return 0;
}
