#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int N = 1e3 + 10;
const long long M = 1e9 + 7;
int n, m, q, t, m1[N][N], m2[N][N], m3[N][N], m4[N][N];
int p1[N][N], p2[N][N], p3[N][N], p4[N][N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(8) << fixed;
  cin >> n >> m >> q;
  for (int i = 0; i < (int)n; ++i) {
    for (int j = 0; j < (int)m; ++j) {
      cin >> m1[i][j];
      m2[i][m - 1 - j] = m1[i][j];
      m3[j][i] = m1[i][j];
      m4[j][n - 1 - i] = m3[j][i];
    }
  }
  for (int i = 0; i < (int)n; ++i) {
    p1[i][0] = m1[i][0];
    p2[i][0] = m2[i][0];
    for (int j = 1; j <= (int)m - 1; ++j) {
      if (m1[i][j])
        p1[i][j] = p1[i][j - 1] + m1[i][j];
      else
        p1[i][j] = 0;
      if (m2[i][j])
        p2[i][j] = p2[i][j - 1] + m2[i][j];
      else
        p2[i][j] = 0;
    }
  }
  for (int i = 0; i < (int)m; ++i) {
    p3[i][0] = m3[i][0];
    p4[i][0] = m4[i][0];
    for (int j = 1; j <= (int)n - 1; ++j) {
      if (m3[i][j])
        p3[i][j] = p3[i][j - 1] + m3[i][j];
      else
        p3[i][j] = 0;
      if (m4[i][j])
        p4[i][j] = p4[i][j - 1] + m4[i][j];
      else
        p4[i][j] = 0;
    }
  }
  int r, c;
  for (int i = 0; i < (int)q; ++i) {
    cin >> t >> r >> c;
    r--, c--;
    if (t == 1) {
      m1[r][c] = 1 - m1[r][c];
      p1[r][0] = m1[r][0];
      for (int j = 1; j <= (int)m - 1; ++j)
        p1[r][j] = (m1[r][j] ? p1[r][j - 1] + m1[r][j] : 0);
      int rr = r, cc = m - 1 - c;
      m2[rr][cc] = 1 - m2[rr][cc];
      p2[rr][0] = m2[rr][0];
      for (int j = 1; j <= (int)m - 1; ++j)
        p2[rr][j] = (m2[rr][j] ? p2[rr][j - 1] + m2[rr][j] : 0);
      rr = c, cc = r;
      m3[rr][cc] = 1 - m3[rr][cc];
      p3[rr][0] = m3[rr][0];
      for (int j = 1; j <= (int)n - 1; ++j)
        p3[rr][j] = (m3[rr][j] ? p3[rr][j - 1] + m3[rr][j] : 0);
      rr = c, cc = n - 1 - r;
      m4[rr][cc] = 1 - m4[rr][cc];
      p4[rr][0] = m4[rr][0];
      for (int j = 1; j <= (int)n - 1; ++j)
        p4[rr][j] = (m4[rr][j] ? p4[rr][j - 1] + m4[rr][j] : 0);
    } else {
      int rr = r, cc = c, w = p1[r][c], h = 1, ans = 0;
      int L = r - 1, R = r + 1;
      ans = max(ans, w * h);
      while (L >= 0 || R < n) {
        int wl = (L >= 0 ? p1[L][c] : 0);
        int wr = (R < n ? p1[R][c] : 0);
        if (wl + wr == 0) break;
        if (wl > wr) {
          h++;
          L--;
          w = min(w, wl);
        } else {
          h++;
          R++;
          w = min(w, wr);
        }
        ans = max(ans, w * h);
      }
      r = rr, c = m - 1 - cc;
      w = p2[r][c], h = 1, L = r - 1, R = r + 1;
      ans = max(ans, w * h);
      while (L >= 0 || R < n) {
        int wl = (L >= 0 ? p2[L][c] : 0);
        int wr = (R < n ? p2[R][c] : 0);
        if (wl + wr == 0) break;
        if (wl > wr) {
          h++;
          L--;
          w = min(w, wl);
        } else {
          h++;
          R++;
          w = min(w, wr);
        }
        ans = max(ans, w * h);
      }
      r = cc, c = rr;
      w = p3[r][c], h = 1, L = r - 1, R = r + 1;
      ans = max(ans, w * h);
      while (L >= 0 || R < m) {
        int wl = (L >= 0 ? p3[L][c] : 0);
        int wr = (R < m ? p3[R][c] : 0);
        if (wl + wr == 0) break;
        if (wl > wr) {
          h++;
          L--;
          w = min(w, wl);
        } else {
          h++;
          R++;
          w = min(w, wr);
        }
        ans = max(ans, w * h);
      }
      r = cc, c = n - 1 - rr;
      w = p4[r][c], h = 1, L = r - 1, R = r + 1;
      ans = max(ans, w * h);
      while (L >= 0 || R < m) {
        int wl = (L >= 0 ? p4[L][c] : 0);
        int wr = (R < m ? p4[R][c] : 0);
        if (wl + wr == 0) break;
        if (wl > wr) {
          h++;
          L--;
          w = min(w, wl);
        } else {
          h++;
          R++;
          w = min(w, wr);
        }
        ans = max(ans, w * h);
      }
      cout << ans << '\n';
    }
  }
}
