#include <bits/stdc++.h>
#pragma comment(linker, "/stack:32000000")
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
void out(const vector<vector<int> >& v) {
  for (int i = 0; i < int((v).size()); ++i) {
    for (int j = 0; j < int((v[0]).size()); ++j) cout << v[i][j] << " ";
    cout << "\n";
  }
  cout << "\n";
}
vector<int> solve(vector<vector<int> > a,
                  const vector<pair<int, pair<int, int> > >& q) {
  int n = int((a).size());
  int m = int((a[0]).size());
  vector<vector<int> > up(n, vector<int>(m));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      up[i][j] = a[i][j];
      if (a[i][j] && i) up[i][j] += up[i - 1][j];
    }
  vector<int> ans(int((q).size()));
  for (int tt = 0; tt < int((q).size()); ++tt) {
    int ti = q[tt].second.first;
    int tj = q[tt].second.second;
    if (q[tt].first == 1) {
      a[ti][tj] ^= 1;
      for (int i = ti; i < n; ++i) {
        up[i][tj] = a[i][tj];
        if (a[i][tj] && i) up[i][tj] += up[i - 1][tj];
      }
    } else {
      stack<pair<int, int> > st;
      st.push(make_pair(0, -1));
      for (int j = 0; j < m + 1; ++j) {
        int h = 0;
        if (j < m) h = up[ti][j];
        int lstj = j;
        while (int((st).size()) && st.top().first > h) {
          int curs = (j - st.top().second) * st.top().first;
          if (st.top().second <= tj && tj < j) ans[tt] = max(ans[tt], curs);
          lstj = st.top().second;
          st.pop();
        }
        st.push(make_pair(h, lstj));
      }
    }
  }
  return ans;
}
int main() {
  int n, m, Q;
  scanf("%d%d%d", &n, &m, &Q);
  vector<vector<int> > a(n, vector<int>(m));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) scanf("%d", &a[i][j]);
  vector<pair<int, pair<int, int> > > q(Q);
  for (int i = 0; i < Q; ++i) {
    scanf("%d%d%d", &q[i].first, &q[i].second.first, &q[i].second.second);
    --q[i].second.first;
    --q[i].second.second;
  }
  vector<int> ans(Q);
  for (int iter = 0; iter < 2; ++iter) {
    for (int iter2 = 0; iter2 < 2; ++iter2) {
      vector<int> tmp = solve(a, q);
      for (int i = 0; i < int((tmp).size()); ++i) ans[i] = max(ans[i], tmp[i]);
      for (int i = 0; i < n - 1 - i; ++i) {
        for (int j = 0; j < m; ++j) {
          swap(a[i][j], a[n - 1 - i][j]);
        }
      }
      for (int i = 0; i < Q; ++i) q[i].second.first = n - 1 - q[i].second.first;
    }
    vector<vector<int> > b(m, vector<int>(n));
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j) b[j][i] = a[i][j];
    a = b;
    for (int i = 0; i < Q; ++i) swap(q[i].second.first, q[i].second.second);
    swap(n, m);
  }
  for (int i = 0; i < Q; ++i)
    if (q[i].first == 2) printf("%d\n", ans[i]);
  return 0;
}
