#include <bits/stdc++.h>
using namespace std;
int n, m, q, t0, ans, r, c;
string st;
vector<vector<bool>> a;
vector<vector<vector<int>>> l;
void update(int r, int c) {
  a[r][c] = !a[r][c];
  if (a[r][c] == false) {
    for (int i = 0; i <= c; i++) {
      if (i + l[1][r][i] > c) {
        l[1][r][i] = c - i;
      }
    }
    for (int i = c; i < m; i++) {
      if (i - l[3][r][i] + 1 <= c) {
        l[3][r][i] = i - c;
      }
    }
    for (int i = 0; i <= r; i++) {
      if (i + l[2][i][c] > r) {
        l[2][i][c] = r - i;
      }
    }
    for (int i = r; i < n; i++) {
      if (i - l[0][i][c] + 1 <= r) {
        l[0][i][c] = i - r;
      }
    }
  } else {
    for (int i = 0; i <= c; i++) {
      if (i + l[1][r][i] == c) {
        l[1][r][i] += 1;
        if (c + 1 < m) {
          l[1][r][i] += l[1][r][c + 1];
        }
      }
    }
    for (int i = c; i < m; i++) {
      if (i - l[3][r][i] + 1 == c + 1) {
        l[3][r][i] += 1;
        if (c - 1 >= 0) {
          l[3][r][i] += l[3][r][c - 1];
        }
      }
    }
    for (int i = 0; i <= r; i++) {
      if (i + l[2][i][c] == r) {
        l[2][i][c] += 1;
        if (r + 1 < n) {
          l[2][i][c] += l[2][r + 1][c];
        }
      }
    }
    for (int i = r; i < n; i++) {
      if (i - l[0][i][c] + 1 == r + 1) {
        l[0][i][c] += 1;
        if (r - 1 >= 0) {
          l[0][i][c] += l[0][r - 1][c];
        }
      }
    }
  }
}
void output(int p) {
  return;
  printf("\n\n");
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", l[p][i][j]);
    }
    printf("\n");
  }
  printf("\n\n");
}
void query(int r, int c) {
  if (!a[r][c]) return;
  int t0, t1, t2;
  output(0);
  t0 = l[0][r][c];
  t1 = c;
  t2 = c;
  ans = max(ans, t0);
  int change = 1;
  while (change > 0) {
    change = 0;
    if (t1 - 1 >= 0 && t2 + 1 < m) {
      if (l[0][r][t1 - 1] < l[0][r][t2 + 1]) {
        change = 2;
      } else {
        change = 1;
      }
    } else if (t1 - 1 >= 0) {
      change = 1;
    } else if (t2 + 1 < m) {
      change = 2;
    }
    if (change == 1) {
      t1--;
      t0 = min(t0, l[0][r][t1]);
      ans = max(ans, (t2 - t1 + 1) * t0);
    } else if (change == 2) {
      t2++;
      t0 = min(t0, l[0][r][t2]);
      ans = max(ans, (t2 - t1 + 1) * t0);
    }
  }
  output(2);
  t0 = l[2][r][c];
  t1 = c;
  t2 = c;
  ans = max(ans, t0);
  change = 1;
  while (change > 0) {
    change = 0;
    if (t1 - 1 >= 0 && t2 + 1 < m) {
      if (l[2][r][t1 - 1] < l[2][r][t2 + 1]) {
        change = 2;
      } else {
        change = 1;
      }
    } else if (t1 - 1 >= 0) {
      change = 1;
    } else if (t2 + 1 < m) {
      change = 2;
    }
    if (change == 1) {
      t1--;
      t0 = min(t0, l[2][r][t1]);
      ans = max(ans, (t2 - t1 + 1) * t0);
    } else if (change == 2) {
      t2++;
      t0 = min(t0, l[2][r][t2]);
      ans = max(ans, (t2 - t1 + 1) * t0);
    }
  }
  output(1);
  t0 = l[1][r][c];
  t1 = r;
  t2 = r;
  ans = max(ans, t0);
  change = 1;
  while (change > 0) {
    change = 0;
    if (t1 - 1 >= 0 && t2 + 1 < n) {
      if (l[1][t1 - 1][c] < l[1][t2 + 1][c]) {
        change = 2;
      } else {
        change = 1;
      }
    } else if (t1 - 1 >= 0) {
      change = 1;
    } else if (t2 + 1 < n) {
      change = 2;
    }
    if (change == 1) {
      t1--;
      t0 = min(t0, l[1][t1][c]);
      ans = max(ans, (t2 - t1 + 1) * t0);
    } else if (change == 2) {
      t2++;
      t0 = min(t0, l[1][t2][c]);
      ans = max(ans, (t2 - t1 + 1) * t0);
    }
  }
  output(3);
  t0 = l[3][r][c];
  t1 = r;
  t2 = r;
  ans = max(ans, t0);
  change = 1;
  while (change > 0) {
    change = 0;
    if (t1 - 1 >= 0 && t2 + 1 < n) {
      if (l[3][t1 - 1][c] < l[3][t2 + 1][c]) {
        change = 2;
      } else {
        change = 1;
      }
    } else if (t1 - 1 >= 0) {
      change = 1;
    } else if (t2 + 1 < n) {
      change = 2;
    }
    if (change == 1) {
      t1--;
      t0 = min(t0, l[3][t1][c]);
      ans = max(ans, (t2 - t1 + 1) * t0);
    } else if (change == 2) {
      t2++;
      t0 = min(t0, l[3][t2][c]);
      ans = max(ans, (t2 - t1 + 1) * t0);
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  a = vector<vector<bool>>(2000, vector<bool>(2000, false));
  l = vector<vector<vector<int>>>(
      8, vector<vector<int>>(2000, vector<int>(2000, 0)));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &t0);
      if (t0 == 1) {
        a[i][j] = true;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j]) {
        l[3][i][j] = 1;
        if (j - 1 >= 0) {
          l[3][i][j] += l[3][i][j - 1];
        }
      }
      if (a[i][m - j - 1]) {
        l[1][i][m - j - 1] = 1;
        if (m - j < m) {
          l[1][i][m - j - 1] += l[1][i][m - j];
        }
      }
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      if (a[i][j]) {
        l[0][i][j] = 1;
        if (i - 1 >= 0) {
          l[0][i][j] += l[0][i - 1][j];
        }
      }
      if (a[n - i - 1][j]) {
        l[2][n - i - 1][j] = 1;
        if (n - i < n) {
          l[2][n - i - 1][j] += l[2][n - i][j];
        }
      }
    }
  }
  for (int i = 0; i < 4; i++) {
    output(i);
  }
  int cnt = 0;
  for (int i = 0; i < q; i++) {
    scanf("%d", &t0);
    if (t0 == 1) {
      scanf("%d%d", &r, &c);
      r--, c--;
      update(r, c);
    } else {
      scanf("%d%d", &r, &c);
      r--, c--;
      ans = 0;
      query(r, c);
      printf("%d\n", ans);
    }
  }
}
