#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 10;
int a[N][N], up[N][N], down[N][N], le[N][N], ri[N][N];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, qq;
  cin >> n >> m >> qq;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) cin >> a[i][j];
  for (int i = (1); i <= (n); i++) {
    for (int j = (1); j <= (m); j++)
      if (a[i][j]) le[i][j] = le[i][j - 1] + 1;
    for (int j = (m); j >= (1); j--)
      if (a[i][j]) ri[i][j] = ri[i][j + 1] + 1;
  }
  for (int j = (1); j <= (m); j++) {
    for (int i = (1); i <= (n); i++)
      if (a[i][j]) up[i][j] = up[i - 1][j] + 1;
    for (int i = (n); i >= (1); i--)
      if (a[i][j]) down[i][j] = down[i + 1][j] + 1;
  }
  while (qq--) {
    int t, x, y;
    cin >> t >> x >> y;
    if (t == 1) {
      a[x][y] ^= 1;
      for (int j = (1); j <= (m); j++)
        if (a[x][j] == 0)
          le[x][j] = 0;
        else
          le[x][j] = le[x][j - 1] + 1;
      for (int j = (m); j >= (1); j--)
        if (a[x][j] == 0)
          ri[x][j] = 0;
        else
          ri[x][j] = ri[x][j + 1] + 1;
      for (int i = (1); i <= (n); i++)
        if (a[i][y] == 0)
          up[i][y] = 0;
        else
          up[i][y] = up[i - 1][y] + 1;
      for (int i = (n); i >= (1); i--)
        if (a[i][y] == 0)
          down[i][y] = 0;
        else
          down[i][y] = down[i + 1][y] + 1;
    } else {
      int t1 = 0, t2 = 0, t3 = 0, t4 = 0;
      int p = x, q = x;
      for (int i = (le[x][y]); i >= (1); i--) {
        while (p > 1 && le[p - 1][y] >= i) p--;
        while (q < n && le[q + 1][y] >= i) q++;
        t1 = max(t1, i * (q - p + 1));
      }
      p = x, q = x;
      for (int i = (ri[x][y]); i >= (1); i--) {
        while (p > 1 && ri[p - 1][y] >= i) p--;
        while (q < n && ri[q + 1][y] >= i) q++;
        t2 = max(t2, i * (q - p + 1));
      }
      p = y, q = y;
      for (int i = (up[x][y]); i >= (1); i--) {
        while (p > 1 && up[x][p - 1] >= i) p--;
        while (q < m && up[x][q + 1] >= i) q++;
        t3 = max(t3, i * (q - p + 1));
      }
      p = y, q = y;
      for (int i = (down[x][y]); i >= (1); i--) {
        while (p > 1 && down[x][p - 1] >= i) p--;
        while (q < m && down[x][q + 1] >= i) q++;
        t4 = max(t4, i * (q - p + 1));
      }
      cout << max(max(t1, t2), max(t3, t4)) << '\n';
    }
  }
  return 0;
}
