#include <bits/stdc++.h>
using namespace std;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return s == 0 ? 0 : cntbit(s >> 1) + (s & 1);
}
int l[1005][1005], r[1005][1005], u[1005][1005], d[1005][1005];
int n, m, q;
int a[1005][1005];
void caln(int id) {
  for (int i = (1); i <= (m); ++i) {
    if (!a[id][i])
      l[id][i] = -1;
    else {
      if (a[id][i - 1])
        l[id][i] = l[id][i - 1];
      else
        l[id][i] = i;
    }
  }
  for (int i = (m); i >= (1); --i) {
    if (!a[id][i])
      r[id][i] = -1;
    else {
      if (a[id][i + 1])
        r[id][i] = r[id][i + 1];
      else
        r[id][i] = i;
    }
  }
}
void cald(int id) {
  for (int i = (1); i <= (n); ++i) {
    if (!a[i][id])
      u[i][id] = -1;
    else {
      if (a[i - 1][id])
        u[i][id] = u[i - 1][id];
      else
        u[i][id] = i;
    }
  }
  for (int i = (n); i >= (1); --i) {
    if (!a[i][id])
      d[i][id] = -1;
    else {
      if (a[i + 1][id])
        d[i][id] = d[i + 1][id];
      else
        d[i][id] = i;
    }
  }
}
int gon(int x, int y) {
  int res = 0;
  int R = m, L = 1;
  for (int i = x; i >= 1; i--) {
    if (!a[i][y]) break;
    R = min(R, r[i][y]);
    L = max(L, l[i][y]);
    res = max(res, (R - L + 1) * (x - i + 1));
  }
  R = m;
  L = 1;
  for (int i = x; i <= n; i++) {
    if (!a[i][y]) break;
    R = min(R, r[i][y]);
    L = max(L, l[i][y]);
    res = max(res, (R - L + 1) * (i - x + 1));
  }
  return res;
}
int god(int x, int y) {
  int res = 0;
  int U = 1, D = n;
  for (int i = y; i >= 1; i--) {
    if (!a[x][i]) break;
    U = max(U, u[x][i]);
    D = min(D, d[x][i]);
    res = max(res, (y - i + 1) * (D - U + 1));
  }
  U = 1;
  D = n;
  for (int i = y; i <= m; i++) {
    if (!a[x][i]) break;
    U = max(U, u[x][i]);
    D = min(D, d[x][i]);
    res = max(res, (i - y + 1) * (D - U + 1));
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> q;
  memset(a, 0, sizeof(a));
  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) {
    caln(i);
  }
  for (int i = (1); i <= (m); ++i) {
    cald(i);
  }
  for (int run = 0; run < (q); ++run) {
    int hoi, rr, cc;
    cin >> hoi >> rr >> cc;
    if (hoi == 1) {
      a[rr][cc] = 1 - a[rr][cc];
      caln(rr);
      cald(cc);
    } else {
      int res = 0;
      res = max(res, gon(rr, cc));
      res = max(res, god(rr, cc));
      cout << res << endl;
    }
  }
  return 0;
}
