#include <bits/stdc++.h>
using namespace std;
int tree[1009][1009], a[1009][1009], n, m;
void update(int idx, int y, int val) {
  while (idx <= n) {
    tree[y][idx] += val;
    idx += (idx & -idx);
  }
}
int sum(int idx, int y) {
  int val = 0;
  while (idx > 0) {
    val += tree[y][idx];
    idx -= (idx & -idx);
  }
  return val;
}
int up(int y, int x) {
  if (a[x][y] == 0) return 0;
  int low = 1;
  int high = x;
  while (low < high) {
    int mid = (low + high) / 2;
    if (sum(x, y) - sum(mid - 1, y) == x - mid + 1)
      high = mid;
    else
      low = mid + 1;
  }
  return (x - low + 1);
}
int down(int y, int x) {
  if (a[x][y] == 0) return 0;
  int low = x;
  int high = n;
  while (low < high) {
    int mid = (low + high + 1) / 2;
    if (sum(mid, y) - sum(x - 1, y) == mid - x + 1)
      low = mid;
    else
      high = mid - 1;
  }
  return (low - x + 1);
}
int upcheck(int x, int y) {
  int maxi = 0, mini = 2000000000;
  int left = y;
  int right = y;
  while (1) {
    mini = min(mini, min(up(left, x), up(right, x)));
    maxi = max(maxi, mini * (right - left + 1));
    if (right == m && left == 1) break;
    if (left == 1)
      right++;
    else if (right == m)
      left--;
    else if (up(left - 1, x) > up(right + 1, x))
      left--;
    else
      right++;
  }
  return maxi;
}
int rightcheck(int x, int y) {
  int maxi = 0;
  int ups = 2000000000, bots = 2000000000;
  for (int j = int(y); j <= int(m); j++) {
    ups = min(ups, up(j, x));
    bots = min(bots, down(j, x));
    if (ups > 0 && bots > 0) maxi = max(maxi, (ups + bots - 1) * (j - y + 1));
  }
  return maxi;
}
int leftcheck(int x, int y) {
  int maxi = 0;
  int ups = 2000000000, bots = 2000000000;
  for (int j = int(y); j >= int(1); j--) {
    ups = min(ups, up(j, x));
    bots = min(bots, down(j, x));
    if (ups > 0 && bots > 0) maxi = max(maxi, (ups + bots - 1) * (y - j + 1));
  }
  return maxi;
}
int downcheck(int x, int y) {
  int maxi = 0, mini = 2000000000;
  int left = y;
  int right = y;
  while (1) {
    mini = min(mini, min(down(left, x), down(right, x)));
    maxi = max(maxi, mini * (right - left + 1));
    if (right == m && left == 1) break;
    if (left == 1)
      right++;
    else if (right == m)
      left--;
    else if (down(left - 1, x) > down(right + 1, x))
      left--;
    else
      right++;
  }
  return maxi;
}
int main() {
  scanf("%d", &n);
  scanf("%d", &m);
  int q;
  scanf("%d", &q);
  for (int i = int(1); i <= int(n); i++) {
    for (int j = int(1); j <= int(m); j++) {
      scanf("%d", &a[i][j]);
      update(i, j, a[i][j]);
    }
  }
  for (int i = int(0); i <= int(q - 1); i++) {
    int type, x, y;
    scanf("%d", &type);
    scanf("%d", &x);
    scanf("%d", &y);
    if (type == 1) {
      if (a[x][y] == 1)
        update(x, y, -1);
      else
        update(x, y, 1);
      a[x][y] ^= 1;
    } else {
      int maxi = downcheck(x, y);
      maxi = max(maxi, upcheck(x, y));
      maxi = max(maxi, leftcheck(x, y));
      maxi = max(maxi, rightcheck(x, y));
      printf("%d\n", maxi);
    }
  }
  return 0;
}
