#include <bits/stdc++.h>
using namespace std;
int board[1001 + 10][1001 + 10];
int leftt[1001 + 10][1001 + 10], rightt[1001 + 10][1001 + 10],
    up[1001 + 10][1001 + 10], down[1001 + 10][1001 + 10];
int n, m;
void row_update(int x) {
  for (int j = m - 1; j >= 0; j--) {
    if (board[x][j] == 0)
      rightt[x][j] = 0;
    else
      rightt[x][j] = 1 + rightt[x][j + 1];
  }
  for (int j = 0; j < m; j++) {
    if (board[x][j] == 0)
      leftt[x][j] = 0;
    else
      leftt[x][j] = 1 + (j - 1 >= 0 ? leftt[x][j - 1] : 0);
  }
}
void col_update(int y) {
  for (int i = n - 1; i >= 0; i--) {
    if (board[i][y] == 0)
      down[i][y] = 0;
    else
      down[i][y] = 1 + down[i + 1][y];
  }
  for (int i = 0; i < n; i++) {
    if (board[i][y] == 0)
      up[i][y] = 0;
    else
      up[i][y] = 1 + (i - 1 >= 0 ? up[i - 1][y] : 0);
  }
}
int calc(int x, int y) {
  if (board[x][y] == 0) return 0;
  int res = 0, l, r, u, d, H;
  H = down[x][y];
  l = r = y;
  for (int i = H; i > 0; i--) {
    while (l >= 0 && down[x][l] >= i) l--;
    while (r < m && down[x][r] >= i) r++;
    res = max(res, i * (r - l - 1));
  }
  H = up[x][y];
  l = r = y;
  for (int i = H; i > 0; i--) {
    while (l >= 0 && up[x][l] >= i) l--;
    while (r < m && up[x][r] >= i) r++;
    res = max(res, i * (r - l - 1));
  }
  H = rightt[x][y];
  u = d = x;
  for (int i = H; i > 0; i--) {
    while (u >= 0 && rightt[u][y] >= i) u--;
    while (d < n && rightt[d][y] >= i) d++;
    res = max(res, i * (d - u - 1));
  }
  H = leftt[x][y];
  u = d = x;
  for (int i = H; i > 0; i--) {
    while (u >= 0 && leftt[u][y] >= i) u--;
    while (d < n && leftt[d][y] >= i) d++;
    res = max(res, i * (d - u - 1));
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  int q, x, y, type;
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> board[i][j];
  for (int i = 0; i < n; i++) row_update(i);
  for (int j = 0; j < m; j++) col_update(j);
  while (q--) {
    cin >> type >> x >> y;
    x--, y--;
    if (type == 1) {
      board[x][y] ^= 1;
      row_update(x);
      col_update(y);
    } else {
      int res = calc(x, y);
      cout << res << endl;
    }
  }
  return 0;
}
