#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int> > a(n, vector<int>(m));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> a[i][j];
  vector<vector<int> > left(n, vector<int>(m)), right(n, vector<int>(m)),
      upper(n, vector<int>(m)), down(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    int cur = m;
    for (int j = m - 1; j >= 0; --j) {
      if (!a[i][j]) cur = j;
      right[i][j] = cur;
    }
    cur = -1;
    for (int j = 0; j < m; ++j) {
      if (!a[i][j]) cur = j;
      left[i][j] = cur;
    }
  }
  for (int j = 0; j < m; ++j) {
    int cur = n;
    for (int i = n - 1; i >= 0; --i) {
      if (!a[i][j]) cur = i;
      down[i][j] = cur;
    }
    cur = -1;
    for (int i = 0; i < n; ++i) {
      if (!a[i][j]) cur = i;
      upper[i][j] = cur;
    }
  }
  for (int k = 0; k < q; ++k) {
    int op, x, y;
    cin >> op >> x >> y;
    --x, --y;
    if (op == 1) {
      if (!a[x][y]) {
        a[x][y] = 1;
        int cur = m;
        if (y < m - 1) cur = right[x][y + 1];
        for (int j = y; j >= 0 && a[x][j]; --j) right[x][j] = cur;
        cur = -1;
        if (y > 0) cur = left[x][y - 1];
        for (int j = y; j < m && a[x][j]; ++j) left[x][j] = cur;
        cur = n;
        if (x < n - 1) cur = down[x + 1][y];
        for (int i = x; i >= 0 && a[i][y]; --i) down[i][y] = cur;
        cur = -1;
        if (x > 0) cur = upper[x - 1][y];
        for (int i = x; i < n && a[i][y]; ++i) upper[i][y] = cur;
      } else {
        a[x][y] = 0;
        right[x][y] = left[x][y] = y;
        upper[x][y] = down[x][y] = x;
        for (int j = y - 1; j >= 0 && a[x][j]; --j) right[x][j] = y;
        for (int j = y + 1; j < m && a[x][j]; ++j) left[x][j] = y;
        for (int i = x - 1; i >= 0 && a[i][y]; --i) down[i][y] = x;
        for (int i = x + 1; i < n && a[i][y]; ++i) upper[i][y] = x;
      }
    } else {
      int ans = 0;
      int cur1 = x, cur2 = x;
      int cur = right[x][y] - y;
      while (cur1 > 0 || cur2 < n - 1) {
        ans = max(ans, (cur2 - cur1 + 1) * cur);
        if (cur1 > 0 && cur2 < n - 1 &&
            right[cur1 - 1][y] > right[cur2 + 1][y]) {
          --cur1;
          cur = min(cur, right[cur1][y] - y);
        } else if (cur1 > 0 && cur2 < n - 1 &&
                   right[cur1 - 1][y] <= right[cur2 + 1][y]) {
          ++cur2;
          cur = min(cur, right[cur2][y] - y);
        } else if (cur1 == 0) {
          ++cur2;
          cur = min(cur, right[cur2][y] - y);
        } else if (cur2 == n - 1) {
          --cur1;
          cur = min(cur, right[cur1][y] - y);
        }
      }
      ans = max(ans, n * cur);
      cur1 = x, cur2 = x;
      cur = y - left[x][y];
      while (cur1 > 0 || cur2 < n - 1) {
        ans = max(ans, (cur2 - cur1 + 1) * cur);
        if (cur1 > 0 && cur2 < n - 1 && left[cur1 - 1][y] < left[cur2 + 1][y]) {
          --cur1;
          cur = min(cur, y - left[cur1][y]);
        } else if (cur1 > 0 && cur2 < n - 1 &&
                   left[cur1 - 1][y] >= left[cur2 + 1][y]) {
          ++cur2;
          cur = min(cur, y - left[cur2][y]);
        } else if (cur1 == 0) {
          ++cur2;
          cur = min(cur, y - left[cur2][y]);
        } else if (cur2 == n - 1) {
          --cur1;
          cur = min(cur, y - left[cur1][y]);
        }
      }
      ans = max(ans, n * cur);
      cur1 = y, cur2 = y;
      cur = x - upper[x][y];
      while (cur1 > 0 || cur2 < m - 1) {
        ans = max(ans, (cur2 - cur1 + 1) * cur);
        if (cur1 > 0 && cur2 < m - 1 &&
            upper[x][cur1 - 1] < upper[x][cur2 + 1]) {
          --cur1;
          cur = min(cur, x - upper[x][cur1]);
        } else if (cur1 > 0 && cur2 < m - 1 &&
                   upper[x][cur1 - 1] >= upper[x][cur2 + 1]) {
          ++cur2;
          cur = min(cur, x - upper[x][cur2]);
        } else if (cur1 == 0) {
          ++cur2;
          cur = min(cur, x - upper[x][cur2]);
        } else if (cur2 == m - 1) {
          --cur1;
          cur = min(cur, x - upper[x][cur1]);
        }
      }
      ans = max(ans, m * cur);
      cur1 = y, cur2 = y;
      cur = down[x][y] - x;
      while (cur1 > 0 || cur2 < m - 1) {
        ans = max(ans, (cur2 - cur1 + 1) * cur);
        if (cur1 > 0 && cur2 < m - 1 && down[x][cur1 - 1] > down[x][cur2 + 1]) {
          --cur1;
          cur = min(cur, down[x][cur1] - x);
        } else if (cur1 > 0 && cur2 < m - 1 &&
                   down[x][cur1 - 1] <= down[x][cur2 + 1]) {
          ++cur2;
          cur = min(cur, down[x][cur2] - x);
        } else if (cur1 == 0) {
          ++cur2;
          cur = min(cur, down[x][cur2] - x);
        } else if (cur2 == m - 1) {
          --cur1;
          cur = min(cur, down[x][cur1] - x);
        }
      }
      ans = max(ans, m * cur);
      cout << ans << "\n";
    }
  }
  return 0;
}
