#include <bits/stdc++.h>
using namespace std;
template <class T>
T min(const T& a, const T& b, const T& c) {
  return min(min(a, b), c);
}
template <class T>
T max(const T& a, const T& b, const T& c) {
  return max(max(a, b), c);
}
void debug() {}
int getch() {
  int ch;
  while ((ch = getchar()) != EOF) {
    if (ch != ' ' && ch != '\n') return ch;
  }
  return EOF;
}
const int maxn = 1100;
int g[maxn][maxn];
int U[maxn][maxn], D[maxn][maxn], L[maxn][maxn], R[maxn][maxn];
int n, m, q;
void prework() {
  for (int j = 1; j <= m; j++)
    for (int i = 1; i <= n; i++) U[i][j] = g[i][j] ? U[i - 1][j] + 1 : 0;
  for (int j = 1; j <= m; j++)
    for (int i = n; i >= 1; i--) D[i][j] = g[i][j] ? D[i + 1][j] + 1 : 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) L[i][j] = g[i][j] ? L[i][j - 1] + 1 : 0;
  for (int i = 1; i <= n; i++)
    for (int j = m; j >= 1; j--) R[i][j] = g[i][j] ? R[i][j + 1] + 1 : 0;
}
void update(int x, int y) {
  g[x][y] ^= 1;
  for (int i = 1; i <= n; i++) U[i][y] = g[i][y] ? U[i - 1][y] + 1 : 0;
  for (int i = n; i >= 1; i--) D[i][y] = g[i][y] ? D[i + 1][y] + 1 : 0;
  for (int j = 1; j <= m; j++) L[x][j] = g[x][j] ? L[x][j - 1] + 1 : 0;
  for (int j = m; j >= 1; j--) R[x][j] = g[x][j] ? R[x][j + 1] + 1 : 0;
}
int query(int x, int y) {
  int l, r;
  int maxv = 0;
  l = r = y;
  for (int h = U[x][y]; h >= 1; h--) {
    while (l >= 1 && U[x][l] >= h) l--;
    while (r <= m && U[x][r] >= h) r++;
    maxv = max(maxv, h * (r - l - 1));
  }
  l = r = y;
  for (int h = D[x][y]; h >= 1; h--) {
    while (l >= 1 && D[x][l] >= h) l--;
    while (r <= m && D[x][r] >= h) r++;
    maxv = max(maxv, h * (r - l - 1));
  }
  l = r = x;
  for (int h = L[x][y]; h >= 1; h--) {
    while (l >= 1 && L[l][y] >= h) l--;
    while (r <= n && L[r][y] >= h) r++;
    maxv = max(maxv, h * (r - l - 1));
  }
  l = r = x;
  for (int h = R[x][y]; h >= 1; h--) {
    while (l >= 1 && R[l][y] >= h) l--;
    while (r <= n && R[r][y] >= h) r++;
    maxv = max(maxv, h * (r - l - 1));
  }
  return maxv;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &g[i][j]);
  prework();
  for (int i = 1; i <= q; i++) {
    int op, x, y;
    scanf("%d%d%d", &op, &x, &y);
    if (op == 1)
      update(x, y);
    else {
      int ans = query(x, y);
      printf("%d\n", ans);
    }
  }
  return 0;
}
