#include <bits/stdc++.h>
using namespace std;
int n, m, ans, l, r, q, op, x, y, a[1010][1010], b[1010][1010], c[1010][1010],
    d[1010][1010], e[1010][1010];
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      cin >> a[i][j];
      if (a[i][j]) {
        b[i][j] = b[i][j - 1] + 1;
        d[i][j] = d[i - 1][j] + 1;
      }
    }
  for (int i = n; i > 0; --i)
    for (int j = m; j > 0; --j)
      if (a[i][j]) {
        c[i][j] = c[i][j + 1] + 1;
        e[i][j] = e[i + 1][j] + 1;
      }
  while (q--) {
    cin >> op >> x >> y;
    if (op == 1) {
      a[x][y] ^= 1;
      for (int j = 1; j <= m; ++j)
        if (a[x][j])
          b[x][j] = b[x][j - 1] + 1;
        else
          b[x][j] = 0;
      for (int j = m; j > 0; --j)
        if (a[x][j])
          c[x][j] = c[x][j + 1] + 1;
        else
          c[x][j] = 0;
      for (int i = 1; i <= n; ++i)
        if (a[i][y])
          d[i][y] = d[i - 1][y] + 1;
        else
          d[i][y] = 0;
      for (int i = n; i > 0; --i)
        if (a[i][y])
          e[i][y] = e[i + 1][y] + 1;
        else
          e[i][y] = 0;
    } else {
      ans = 0;
      l = r = x;
      for (int j = b[x][y]; j > 0; --j) {
        while (l >= 1 && b[l][y] >= j) l--;
        while (r <= n && b[r][y] >= j) r++;
        ans = max(ans, (r - l - 1) * j);
      }
      l = r = x;
      for (int j = c[x][y]; j > 0; --j) {
        while (l >= 1 && c[l][y] >= j) l--;
        while (r <= n && c[r][y] >= j) r++;
        ans = max(ans, (r - l - 1) * j);
      }
      l = r = y;
      for (int i = d[x][y]; i > 0; --i) {
        while (l >= 1 && d[x][l] >= i) l--;
        while (r <= m && d[x][r] >= i) r++;
        ans = max(ans, (r - l - 1) * i);
      }
      l = r = y;
      for (int i = e[x][y]; i > 0; --i) {
        while (l >= 1 && e[x][l] >= i) l--;
        while (r <= m && e[x][r] >= i) r++;
        ans = max(ans, (r - l - 1) * i);
      }
      cout << ans << endl;
    }
  }
  return 0;
}
