#include <bits/stdc++.h>
using namespace std;
const long long int INF = (1L << 50);
const int MOD = 1e9 + 7;
int x[1010][1010];
int dp[1010][1010][4];
int main(void) {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(m); j++) scanf("%d", &x[i + 1][j + 1]);
  for (int i = 1; i <= n; i++) {
    for (int j = m; j >= 1; j--) {
      if (x[i][j]) dp[i][j][0] = dp[i][j + 1][0] + 1;
    }
  }
  for (int i = n; i >= 1; i--) {
    for (int j = m; j >= 1; j--) {
      if (x[i][j]) dp[i][j][1] = dp[i + 1][j][1] + 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (x[i][j]) dp[i][j][2] = dp[i][j - 1][2] + 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = m; j >= 1; j--) {
      if (x[i][j]) dp[i][j][3] = dp[i - 1][j][3] + 1;
    }
  }
  for (int i = 0; i < (int)(q); i++) {
    int k;
    scanf("%d", &k);
    if (k == 1) {
      int a, b;
      scanf("%d %d", &a, &b);
      x[a][b] = !x[a][b];
      for (int j = m; j >= 1; j--) {
        if (x[a][j])
          dp[a][j][0] = dp[a][j + 1][0] + 1;
        else
          dp[a][j][0] = 0;
      }
      for (int j = 1; j <= m; j++) {
        if (x[a][j])
          dp[a][j][2] = dp[a][j - 1][2] + 1;
        else
          dp[a][j][2] = 0;
      }
      for (int i = n; i >= 1; i--) {
        if (x[i][b])
          dp[i][b][1] = dp[i + 1][b][1] + 1;
        else
          dp[i][b][1] = 0;
      }
      for (int i = 1; i <= n; i++) {
        if (x[i][b])
          dp[i][b][3] = dp[i - 1][b][3] + 1;
        else
          dp[i][b][3] = 0;
      }
    } else {
      int a, b;
      int ans = 0;
      scanf("%d %d", &a, &b);
      vector<pair<int, int> > st;
      for (int i = 1; i <= n; i++) {
        int newData = dp[i][b][0];
        int idx = i;
        while (st.size() && st.back().first > newData) {
          int aa = st.back().first, bb = st.back().second;
          st.pop_back();
          int res = aa * (i - bb);
          if (i > a && a >= bb) {
            ans = max(res, ans);
          }
          idx = bb;
        }
        st.push_back(pair<int, int>(newData, idx));
      }
      while (st.size()) {
        int aa = st.back().first, bb = st.back().second;
        st.pop_back();
        int res = aa * (n + 1 - bb);
        if (a >= bb) {
          ans = max(res, ans);
        }
      }
      for (int i = 1; i <= n; i++) {
        int newData = dp[i][b][2];
        int idx = i;
        while (st.size() && st.back().first > newData) {
          int aa = st.back().first, bb = st.back().second;
          st.pop_back();
          int res = aa * (i - bb);
          if (i > a && a >= bb) {
            ans = max(res, ans);
          }
          idx = bb;
        }
        st.push_back(pair<int, int>(newData, idx));
      }
      while (st.size()) {
        int aa = st.back().first, bb = st.back().second;
        st.pop_back();
        int res = aa * (n + 1 - bb);
        if (a >= bb) {
          ans = max(res, ans);
        }
      }
      for (int j = 1; j <= m; j++) {
        int newData = dp[a][j][1];
        int idx = j;
        while (st.size() && st.back().first > newData) {
          int aa = st.back().first, bb = st.back().second;
          st.pop_back();
          int res = aa * (j - bb);
          if (j > b && b >= bb) {
            ans = max(res, ans);
          }
          idx = bb;
        }
        st.push_back(pair<int, int>(newData, idx));
      }
      while (st.size()) {
        int aa = st.back().first, bb = st.back().second;
        st.pop_back();
        int res = aa * (m + 1 - bb);
        if (b >= bb) {
          ans = max(res, ans);
        }
      }
      for (int j = 1; j <= m; j++) {
        int newData = dp[a][j][3];
        int idx = j;
        while (st.size() && st.back().first > newData) {
          int aa = st.back().first, bb = st.back().second;
          st.pop_back();
          int res = aa * (j - bb);
          if (j > b && b >= bb) {
            ans = max(res, ans);
          }
          idx = bb;
        }
        st.push_back(pair<int, int>(newData, idx));
      }
      while (st.size()) {
        int aa = st.back().first, bb = st.back().second;
        st.pop_back();
        int res = aa * (m + 1 - bb);
        if (b >= bb) {
          ans = max(res, ans);
        }
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
