#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1 << 10;
int n, m, q, ans;
vector<vector<int>> A, dp[4];
vector<int> calc(const vector<int> &V) {
  vector<int> ans(V.size());
  for (int i = (0); i < (int)(V.size()); i++) {
    if (V[i]) {
      if (i) ans[i] = ans[i - 1];
      ans[i]++;
    }
  }
  return ans;
}
vector<int> getColumn(const vector<vector<int>> &V, int j) {
  vector<int> ans(V.size());
  for (int i = (0); i < (int)(V.size()); i++) {
    ans[i] = V[i][j];
  }
  return ans;
}
void PPP(const vector<vector<int>> &V) {
  for (int i = (0); i < (int)(V.size()); i++) {
    for (int j = (0); j < (int)(V[i].size()); j++) {
      printf("%d ", V[i][j]);
    }
    puts("");
  }
}
vector<vector<int>> rotate(const vector<vector<int>> &V, int h = 1) {
  if (h == 0) return V;
  int n = V.size();
  int m = V[0].size();
  vector<vector<int>> ans;
  ans.resize(m);
  for (int i = (0); i < (int)(m); i++) {
    ans[i].resize(n);
    for (int j = (0); j < (int)(n); j++) {
      ans[i][j] = V[n - 1 - j][i];
    }
  }
  return rotate(ans, h - 1);
}
vector<int> p;
vector<int> tam;
vector<int> mn;
int findParent(int a) {
  while (p[a] != a) {
    p[a] = p[p[a]];
    a = p[a];
  }
  return a;
}
void merge(int a, int b) {
  a = findParent(a);
  b = findParent(b);
  mn[a] = min(mn[a], mn[b]);
  tam[a] = tam[a] + tam[b];
  p[b] = a;
}
void solve(int pos, vector<int> V) {
  vector<pair<int, int>> W(V.size());
  vector<char> activated(V.size(), false);
  p.clear();
  p.resize(V.size());
  tam.clear();
  tam.resize(V.size());
  mn.clear();
  mn.resize(V.size());
  for (int i = (0); i < (int)(V.size()); i++) {
    W[i] = {V[i], i};
    mn[i] = V[i];
    tam[i] = 1;
    p[i] = i;
  }
  sort(W.begin(), W.end());
  reverse(W.begin(), W.end());
  for (int i = (0); i < (int)(W.size()); i++) {
    pair<int, int> event = W[i];
    int where = event.second;
    activated[where] = true;
    if (where + 1 < (int)V.size() && activated[where + 1]) {
      merge(where, where + 1);
    }
    if (where - 1 >= 0 && activated[where - 1]) {
      merge(where, where - 1);
    }
    int par = findParent(pos);
    ans = max(ans, tam[par] * mn[par]);
  }
}
int main() {
  while (scanf("%d %d %d", &n, &m, &q) == 3) {
    A.resize(n);
    for (int i = (0); i < (int)(n); i++) {
      A[i].resize(m);
      for (int j = (0); j < (int)(m); j++) {
        scanf("%d", &A[i][j]);
      }
    }
    dp[0].resize(n);
    for (int i = (0); i < (int)(n); i++) dp[0][i] = calc(A[i]);
    A = rotate(A);
    dp[1].resize(m);
    for (int i = (0); i < (int)(m); i++) dp[1][i] = calc(A[i]);
    A = rotate(A);
    dp[1] = rotate(dp[1], 3);
    dp[2].resize(n);
    for (int i = (0); i < (int)(n); i++) dp[2][i] = calc(A[i]);
    A = rotate(A);
    dp[2] = rotate(dp[2], 2);
    dp[3].resize(m);
    for (int i = (0); i < (int)(m); i++) dp[3][i] = calc(A[i]);
    A = rotate(A);
    dp[3] = rotate(dp[3]);
    while (q--) {
      int code, x, y;
      scanf("%d %d %d", &code, &x, &y);
      --x;
      --y;
      if (code == 1) {
        A[x][y] = 1 - A[x][y];
        vector<int> W;
        W = A[x];
        dp[0][x] = calc(W);
        W = getColumn(A, y);
        reverse(W.begin(), W.end());
        W = calc(W);
        for (int j = (0); j < (int)(W.size()); j++) {
          dp[1][j][y] = W[(int)W.size() - 1 - j];
        }
        W = A[x];
        reverse(W.begin(), W.end());
        dp[2][x] = calc(W);
        reverse(dp[2][x].begin(), dp[2][x].end());
        W = getColumn(A, y);
        W = calc(W);
        for (int j = (0); j < (int)(W.size()); j++) {
          dp[3][j][y] = W[j];
        }
      } else {
        ans = 0;
        solve(x, getColumn(dp[0], y));
        solve(y, dp[1][x]);
        solve(x, getColumn(dp[2], y));
        solve(y, dp[3][x]);
        printf("%d\n", ans);
      }
    }
  }
  return 0;
}
