#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1010;
int N, M, Q, A[NMAX][NMAX], U[NMAX][NMAX], D[NMAX][NMAX], Op[NMAX], X[NMAX],
    Y[NMAX], Ans[NMAX];
void Solve() {
  memset(U, 0, sizeof(U));
  memset(D, 0, sizeof(D));
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j)
      if (A[i][j])
        U[i][j] = U[i - 1][j] + 1;
      else
        U[i][j] = 0;
  for (int i = N; i; --i)
    for (int j = 1; j <= M; ++j)
      if (A[i][j])
        D[i][j] = D[i + 1][j] + 1;
      else
        D[i][j] = 0;
  for (int k = 1; k <= Q; ++k)
    if (Op[k] == 1) {
      A[X[k]][Y[k]] ^= 1;
      for (int i = 1; i <= N; ++i)
        if (A[i][Y[k]])
          U[i][Y[k]] = U[i - 1][Y[k]] + 1;
        else
          U[i][Y[k]] = 0;
      for (int i = N; i; --i)
        if (A[i][Y[k]])
          D[i][Y[k]] = D[i + 1][Y[k]] + 1;
        else
          D[i][Y[k]] = 0;
    } else {
      int LP = Y[k], RP = Y[k];
      for (int CrtH = U[X[k]][Y[k]]; CrtH >= 1; --CrtH) {
        while (1 <= LP && U[X[k]][LP] >= CrtH) LP--;
        while (RP <= M && U[X[k]][RP] >= CrtH) RP++;
        Ans[k] = max(Ans[k], CrtH * (RP - LP - 1));
      }
      LP = RP = Y[k];
      for (int CrtH = D[X[k]][Y[k]]; CrtH >= 1; --CrtH) {
        while (1 <= LP && D[X[k]][LP] >= CrtH) LP--;
        while (RP <= M && D[X[k]][RP] >= CrtH) RP++;
        Ans[k] = max(Ans[k], CrtH * (RP - LP - 1));
      }
    }
  for (int i = 1; i <= Q; ++i)
    if (Op[i] == 1) A[X[i]][Y[i]] ^= 1;
}
void Rotate() {
  for (int i = 1; i <= max(N, M); ++i)
    for (int j = 1; j <= i; ++j) swap(A[i][j], A[j][i]);
  swap(N, M);
  for (int i = 1; i <= Q; ++i) swap(X[i], Y[i]);
}
int main() {
  scanf("%i %i %i", &N, &M, &Q);
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j) scanf("%i", &A[i][j]);
  for (int i = 1; i <= Q; ++i) scanf("%i %i %i", &Op[i], &X[i], &Y[i]);
  Solve();
  Rotate();
  Solve();
  for (int i = 1; i <= Q; ++i)
    if (Op[i] == 2) printf("%i\n", Ans[i]);
}
