#include <bits/stdc++.h>
const int N = 1024;
int max(int x, int y) { return (x > y) ? x : y; }
int data[N][N], left[N][N], right[N][N], up[N][N], down[N][N], n, m;
void calc_u(int x) {
  for (int y = m; y; --y)
    if (data[x][y])
      up[x][y] = up[x][y + 1] + 1;
    else
      up[x][y] = 0;
}
void calc_d(int x) {
  for (int y = 1; y <= m; ++y)
    if (data[x][y])
      down[x][y] = down[x][y - 1] + 1;
    else
      down[x][y] = 0;
}
void calc_l(int y) {
  for (int x = 1; x <= n; ++x)
    if (data[x][y])
      left[x][y] = left[x - 1][y] + 1;
    else
      left[x][y] = 0;
}
void calc_r(int y) {
  for (int x = n; x; --x)
    if (data[x][y])
      right[x][y] = right[x + 1][y] + 1;
    else
      right[x][y] = 0;
}
int get_u(int x, int y) {
  int a = x, b = x, ans = up[x][y], top = up[x][y];
  while (top) {
    while (up[a - 1][y] >= top) --a;
    while (up[b + 1][y] >= top) ++b;
    ans = max(ans, top * (b - a + 1));
    if (up[a - 1][y] >= up[b + 1][y])
      top = up[a - 1][y];
    else
      top = up[b + 1][y];
  }
  return ans;
}
int get_d(int x, int y) {
  int a = x, b = x, ans = down[x][y], top = down[x][y];
  while (top) {
    while (down[a - 1][y] >= top) --a;
    while (down[b + 1][y] >= top) ++b;
    ans = max(ans, top * (b - a + 1));
    if (down[a - 1][y] >= down[b + 1][y])
      top = down[a - 1][y];
    else
      top = down[b + 1][y];
  }
  return ans;
}
int get_l(int x, int y) {
  int a = y, b = y, ans = left[x][y], top = left[x][y];
  while (top) {
    while (left[x][a - 1] >= top) --a;
    while (left[x][b + 1] >= top) ++b;
    ans = max(ans, top * (b - a + 1));
    if (left[x][a - 1] >= left[x][b + 1])
      top = left[x][a - 1];
    else
      top = left[x][b + 1];
  }
  return ans;
}
int get_r(int x, int y) {
  int a = y, b = y, ans = right[x][y], top = right[x][y];
  while (top) {
    while (right[x][a - 1] >= top) --a;
    while (right[x][b + 1] >= top) ++b;
    ans = max(ans, top * (b - a + 1));
    if (right[x][a - 1] >= right[x][b + 1])
      top = right[x][a - 1];
    else
      top = right[x][b + 1];
  }
  return ans;
}
int main() {
  int q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) scanf("%d", &data[i][j]);
  for (int i = 1; i <= n; ++i) {
    calc_u(i);
    calc_d(i);
  }
  for (int i = 1; i <= m; ++i) {
    calc_l(i);
    calc_r(i);
  }
  int op, a, b;
  while (q--) {
    scanf("%d%d%d", &op, &a, &b);
    if (op == 1) {
      data[a][b] ^= 1;
      calc_u(a);
      calc_d(a);
      calc_l(b);
      calc_r(b);
    } else
      printf("%d\n",
             max(max(get_u(a, b), get_d(a, b)), max(get_l(a, b), get_r(a, b))));
  }
  return 0;
}
