#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <typename T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <typename T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <typename T>
inline void println(T first) {
  print(first), putchar('\n');
}
template <typename T>
inline void printsp(T first) {
  print(first), putchar(' ');
}
template <class T, class T1>
inline void print(T first, T1 second) {
  printsp(first), println(second);
}
template <class T, class T1, class T2>
inline void print(T first, T1 second, T2 z) {
  printsp(first), printsp(second), println(z);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int a[1010][1010];
int mx[1010][1010][4];
vector<int> v[1010];
int main() {
  int n, m, q;
  gn(n, m, q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) gn(a[i][j]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == 1) {
        mx[i][j][0] = mx[i][j - 1][0] + 1;
        mx[i][j][1] = mx[i - 1][j][1] + 1;
      }
    }
  for (int i = n; i >= 1; i--)
    for (int j = m; j >= 1; j--) {
      if (a[i][j] == 1) {
        mx[i][j][2] = mx[i][j + 1][2] + 1;
        mx[i][j][3] = mx[i + 1][j][3] + 1;
      }
    }
  int tp, first, second;
  while (q--) {
    gn(tp, first, second);
    if (tp == 1) {
      a[first][second] ^= 1;
      for (int i = first; i <= n; i++) {
        if (a[i][second])
          mx[i][second][1] = mx[i - 1][second][1] + 1;
        else
          mx[i][second][1] = 0;
      }
      for (int i = first; i >= 1; i--) {
        if (a[i][second])
          mx[i][second][3] = mx[i + 1][second][3] + 1;
        else
          mx[i][second][3] = 0;
      }
      for (int j = second; j <= m; j++) {
        if (a[first][j])
          mx[first][j][0] = mx[first][j - 1][0] + 1;
        else
          mx[first][j][0] = 0;
      }
      for (int j = second; j >= 1; j--) {
        if (a[first][j])
          mx[first][j][2] = mx[first][j + 1][2] + 1;
        else
          mx[first][j][2] = 0;
      }
    } else {
      int ans = 0, L, R;
      for (int i = 1; i <= n; i++) v[i].clear();
      for (int j = second, pre = n; a[first][j] && j <= m; j++)
        v[pre = min(pre, mx[first][j][1])].push_back(j);
      for (int j = second, pre = n; a[first][j] && j >= 1; j--)
        v[pre = min(pre, mx[first][j][1])].push_back(j);
      L = m + 1, R = 0;
      for (int i = n; i >= 1; i--) {
        for (int j = 0; j < v[i].size(); j++) {
          smin(L, v[i][j]);
          smax(R, v[i][j]);
        }
        smax(ans, (R - L + 1) * i);
      }
      for (int i = 1; i <= n; i++) v[i].clear();
      for (int j = second, pre = n; a[first][j] && j <= m; j++)
        v[pre = min(pre, mx[first][j][3])].push_back(j);
      for (int j = second, pre = n; a[first][j] && j >= 1; j--)
        v[pre = min(pre, mx[first][j][3])].push_back(j);
      L = m + 1, R = 0;
      for (int i = n; i >= 1; i--) {
        for (int j = 0; j < v[i].size(); j++) {
          smin(L, v[i][j]);
          smax(R, v[i][j]);
        }
        smax(ans, (R - L + 1) * i);
      }
      for (int i = 1; i <= m; i++) v[i].clear();
      for (int i = first, pre = m; a[i][second] && i <= n; i++)
        v[pre = min(pre, mx[i][second][0])].push_back(i);
      for (int i = first, pre = m; a[i][second] && i >= 1; i--)
        v[pre = min(pre, mx[i][second][0])].push_back(i);
      L = n + 1, R = 0;
      for (int i = m; i >= 1; i--) {
        for (int j = 0; j < v[i].size(); j++) {
          smin(L, v[i][j]);
          smax(R, v[i][j]);
        }
        smax(ans, (R - L + 1) * i);
      }
      for (int i = 1; i <= m; i++) v[i].clear();
      for (int i = first, pre = m; a[i][second] && i <= n; i++)
        v[pre = min(pre, mx[i][second][2])].push_back(i);
      for (int i = first, pre = m; a[i][second] && i >= 1; i--)
        v[pre = min(pre, mx[i][second][2])].push_back(i);
      L = n + 1, R = 0;
      for (int i = m; i >= 1; i--) {
        for (int j = 0; j < v[i].size(); j++) {
          smin(L, v[i][j]);
          smax(R, v[i][j]);
        }
        smax(ans, (R - L + 1) * i);
      }
      println(ans);
    }
  }
  return 0;
}
