#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, a[N][N], m, q;
int up[N][N], down[N][N], l[N][N], r[N][N];
void upd_row(int x) {
  for (int i = 1; i <= m; ++i) {
    if (a[x][i])
      l[x][i] = l[x][i - 1] + 1;
    else
      l[x][i] = 0;
  }
  for (int i = m; i > 0; --i) {
    if (a[x][i])
      r[x][i] = r[x][i + 1] + 1;
    else
      r[x][i] = 0;
  }
}
void upd_col(int x) {
  for (int i = 1; i <= n; ++i) {
    if (a[i][x])
      up[i][x] = up[i - 1][x] + 1;
    else
      up[i][x] = 0;
  }
  for (int i = n; i > 0; --i) {
    if (a[i][x])
      down[i][x] = down[i + 1][x] + 1;
    else
      down[i][x] = 0;
  }
}
int d[N];
int calcrow(int x, int y) {
  int ret = 0;
  int L = x - up[x][y] + 1;
  int R = x + down[x][y] - 1;
  for (int cc = 0; cc < 2; ++cc) {
    if (!cc) {
      d[x] = r[x][y];
      for (int i = x - 1; i >= L; --i) d[i] = min(d[i + 1], r[i][y]);
      for (int i = x + 1; i <= R; ++i) d[i] = min(d[i - 1], r[i][y]);
    } else {
      d[x] = l[x][y];
      for (int i = x - 1; i >= L; --i) d[i] = min(d[i + 1], l[i][y]);
      for (int i = x + 1; i <= R; ++i) d[i] = min(d[i - 1], l[i][y]);
    }
    for (int len = 1; len <= d[x]; ++len) {
      int l = 0, r = 0, g1 = 0, g2 = 0;
      l = L, r = x, g1 = x;
      while (l <= r) {
        int mid = (l + r) >> 1;
        if (d[mid] >= len) {
          g1 = min(g1, mid);
          r = mid - 1;
        } else
          l = mid + 1;
      }
      l = x, r = R, g2 = x;
      while (l <= r) {
        int mid = (l + r) >> 1;
        if (d[mid] >= len) {
          g2 = max(g2, mid);
          l = mid + 1;
        } else
          r = mid - 1;
      }
      ret = max(ret, (g2 - g1 + 1) * len);
    }
  }
  return ret;
}
int calccol(int x, int y) {
  int L = y - l[x][y] + 1;
  int R = y + r[x][y] - 1;
  int ret = 0;
  for (int cc = 0; cc < 2; ++cc) {
    if (!cc) {
      d[y] = up[x][y];
      for (int i = y - 1; i >= L; --i) d[i] = min(d[i + 1], up[x][i]);
      for (int i = y + 1; i <= R; ++i) d[i] = min(d[i - 1], up[x][i]);
    } else {
      d[y] = down[x][y];
      for (int i = y - 1; i >= L; --i) d[i] = min(d[i + 1], down[x][i]);
      for (int i = y + 1; i <= R; ++i) d[i] = min(d[i - 1], down[x][i]);
    }
    for (int len = 1; len <= d[y]; ++len) {
      int l = 0, r = 0, g1 = 0, g2 = 0;
      l = L, r = y, g1 = y;
      while (l <= r) {
        int mid = (l + r) >> 1;
        if (d[mid] >= len) {
          g1 = min(g1, mid);
          r = mid - 1;
        } else
          l = mid + 1;
      }
      l = y, r = R, g2 = y;
      while (l <= r) {
        int mid = (l + r) >> 1;
        if (d[mid] >= len) {
          g2 = max(g2, mid);
          l = mid + 1;
        } else
          r = mid - 1;
      }
      ret = max(ret, (g2 - g1 + 1) * len);
    }
  }
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int i = 1; i <= n; ++i) upd_row(i);
  for (int i = 1; i <= m; ++i) upd_col(i);
  for (int query = 1; query <= q; ++query) {
    int x, y, type;
    scanf("%d%d%d", &type, &x, &y);
    if (type == 1) {
      a[x][y] ^= 1;
      upd_col(y);
      upd_row(x);
    } else {
      if (!a[x][y]) {
        puts("0");
        continue;
      }
      int ans = max(calcrow(x, y), calccol(x, y));
      printf("%d\n", ans);
    }
  }
  return 0;
}
