#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int q;
  cin >> q;
  int a[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  int left[n][m], right[n][m], up[n][m], down[n][m];
  for (int i = 0; i < n; i++) {
    int last = -1;
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 0) last = j;
      left[i][j] = j - last;
    }
  }
  for (int i = 0; i < n; i++) {
    int last = m;
    for (int j = m - 1; j > -1; j--) {
      if (a[i][j] == 0) last = j;
      right[i][j] = last - j;
    }
  }
  for (int i = 0; i < m; i++) {
    int last = -1;
    for (int j = 0; j < n; j++) {
      if (a[j][i] == 0) last = j;
      up[j][i] = j - last;
    }
    last = n;
    for (int j = n - 1; j > -1; j--) {
      if (a[j][i] == 0) last = j;
      down[j][i] = last - j;
    }
  }
  while (q--) {
    int t;
    cin >> t;
    int x, y;
    cin >> x >> y;
    --x, --y;
    if (t == 1) {
      a[x][y] ^= 1;
      int last = -1;
      int i, j;
      i = x;
      for (j = 0; j < m; j++) {
        if (a[i][j] == 0) last = j;
        left[i][j] = j - last;
      }
      last = m;
      for (j = m - 1; j > -1; j--) {
        if (a[i][j] == 0) last = j;
        right[i][j] = last - j;
      }
      last = -1;
      i = y;
      for (j = 0; j < n; j++) {
        if (a[j][i] == 0) last = j;
        up[j][i] = j - last;
      }
      last = n;
      for (j = n - 1; j > -1; j--) {
        if (a[j][i] == 0) last = j;
        down[j][i] = last - j;
      }
    } else {
      int l = x, r = x;
      int ans = 0;
      for (int mn = right[x][y]; mn > -1; mn--) {
        while (l > 0 && right[l - 1][y] >= mn) --l;
        while (r + 1 < n && right[r + 1][y] >= mn) ++r;
        ans = max(ans, (r - l + 1) * mn);
      }
      l = x, r = x;
      for (int mn = left[x][y]; mn > -1; mn--) {
        while (l > 0 && left[l - 1][y] >= mn) --l;
        while (r + 1 < n && left[r + 1][y] >= mn) ++r;
        ans = max(ans, (r - l + 1) * mn);
      }
      l = y, r = y;
      for (int mn = up[x][y]; mn > -1; --mn) {
        while (l > 0 && up[x][l - 1] >= mn) --l;
        while (r + 1 < m && up[x][r + 1] >= mn) ++r;
        ans = max(ans, (r - l + 1) * mn);
      }
      l = y, r = y;
      for (int mn = down[x][y]; mn > -1; --mn) {
        while (l > 0 && down[x][l - 1] >= mn) --l;
        while (r + 1 < m && down[x][r + 1] >= mn) ++r;
        ans = max(ans, (r - l + 1) * mn);
      }
      cout << ans << '\n';
    }
  }
  return 0;
}
