#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T modinv(T a, T n) {
  T i = n, v = 0, d = 1;
  while (a > 0) {
    T t = i / a, x = a;
    a = i % x;
    i = x;
    x = d;
    d = v - t * x;
    v = x;
  }
  return (v + n) % n;
}
long long modpow(long long n, long long k, long long mod) {
  long long ans = 1;
  while (k > 0) {
    if (k & 1) ans = (ans * n) % mod;
    k >>= 1;
    n = (n * n) % mod;
  }
  return ans % mod;
}
template <class T>
string str(T Number) {
  string Result;
  ostringstream convert;
  convert << Number;
  Result = convert.str();
  return Result;
}
int StringToNumber(const string &Text) {
  istringstream ss(Text);
  int result;
  return ss >> result ? result : 0;
}
template <class T>
inline vector<pair<T, int> > FACTORISE(T n) {
  vector<pair<T, int> > R;
  for (T i = 2; n > 1;) {
    if (n % i == 0) {
      int C = 0;
      for (; n % i == 0; C++, n /= i)
        ;
      R.push_back(make_pair(i, C));
    }
    i++;
    if (i > n / i) i = n;
  }
  if (n > 1) R.push_back(make_pair(n, 1));
  return R;
}
template <class T>
inline T TOTIENT(T n) {
  vector<pair<T, int> > R = FACTORISE(n);
  T r = n;
  for (int i = 0; i < R.size(); i++) r = r / R[i].first * (R[i].first - 1);
  return r;
}
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
int U[1010 + 1][1010 + 1], D[1010 + 1][1010 + 1], L[1010 + 1][1010 + 1],
    R[1010 + 1][1010 + 1];
int n, m, q, a[1010 + 1][1010 + 1], b[1010 + 1], seq[1010 + 1];
struct DS {
  int f[1010 + 1];
  void init(int n) {
    for (int i = 0; i <= n + 1; ++i) f[i] = i;
  }
  int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
  void merge(int x, int y) { f[find(x)] = find(y); }
} lf, rf;
inline bool cmp(int x, int y) { return b[x] < b[y]; }
int calc(int n, int x) {
  for (int i = 1; i <= n; ++i) seq[i] = i;
  sort(seq + 1, seq + n + 1, cmp);
  lf.init(n), rf.init(n);
  int ret = 0;
  for (int i = n; i > 0; --i) {
    int l = lf.find(seq[i] - 1) + 1, r = rf.find(seq[i] + 1) - 1;
    if (l <= x && x <= r) ret = max(ret, (r - l + 1) * b[seq[i]]);
    lf.merge(seq[i], seq[i] - 1), rf.merge(seq[i], seq[i] + 1);
  }
  return ret;
}
int main(int argc, char *argv[]) {
  ios ::sync_with_stdio(false);
  cin >> n >> m >> q;
  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]) {
        U[i][j] = U[i - 1][j] + 1;
        L[i][j] = L[i][j - 1] + 1;
      } else
        U[i][j] = L[i][j] = 0;
  for (int i = n; i > 0; --i)
    for (int j = m; j > 0; --j)
      if (a[i][j]) {
        D[i][j] = D[i + 1][j] + 1;
        R[i][j] = R[i][j + 1] + 1;
      } else
        D[i][j] = R[i][j] = 0;
  while (q--) {
    int op, x, y;
    cin >> op >> x >> y;
    if (op == 1) {
      a[x][y] ^= 1;
      for (int i = x; i <= n; ++i)
        if (a[i][y])
          U[i][y] = U[i - 1][y] + 1;
        else
          U[i][y] = 0;
      for (int j = y; j <= m; ++j)
        if (a[x][j])
          L[x][j] = L[x][j - 1] + 1;
        else
          L[x][j] = 0;
      for (int i = x; i > 0; --i)
        if (a[i][y])
          D[i][y] = D[i + 1][y] + 1;
        else
          D[i][y] = 0;
      for (int j = y; j > 0; --j)
        if (a[x][j])
          R[x][j] = R[x][j + 1] + 1;
        else
          R[x][j] = 0;
    } else {
      int ans = 0;
      for (int i = 1; i <= m; ++i) b[i] = U[x][i];
      ans = max(ans, calc(m, y));
      for (int i = 1; i <= m; ++i) b[i] = D[x][i];
      ans = max(ans, calc(m, y));
      for (int i = 1; i <= n; ++i) b[i] = L[i][y];
      ans = max(ans, calc(n, x));
      for (int i = 1; i <= n; ++i) b[i] = R[i][y];
      ans = max(ans, calc(n, x));
      cout << ans << endl;
    }
  }
  fclose(stdin);
  fclose(stdout);
  return 0;
}
