#include <bits/stdc++.h>   using namespace std;   int xx[4] = {0, 0, 1, -1};   int yy[4] = {1, -1, 0, 0};   int n, m, q;   int h[int(1e3 + 100)], dem, st[int(1e3 + 100)], vt[int(1e3 + 100)], top, mid;   int a[int(1e3 + 100)][int(1e3 + 100)];   int hl[int(1e3 + 100)][int(1e3 + 100)], cl[int(1e3 + 100)][int(1e3 + 100)],       cr[int(1e3 + 100)][int(1e3 + 100)], hr[int(1e3 + 100)][int(1e3 + 100)];   int solve() {     int res = 0;     h[dem + 1] = 0;     for (int i = (1), _b = (dem + 1); i <= _b; i++) {       int y = i;       while (top != 0 && h[i] <= st[top]) {         if (vt[top] <= mid && mid < i) res = max(res, (i - vt[top]) * st[top]);         y = vt[top];         top--;       }       if (h[i] > st[top]) {         top++;         st[top] = h[i];         vt[top] = y;       }     }     return res;   }   int main() {     scanf( %d%d%d , &n, &m, &q);     for (int i = (1), _b = (n); i <= _b; i++)       for (int j = (1), _b = (m); j <= _b; j++) scanf( %d , &a[i][j]);     for (int i = (1), _b = (n); i <= _b; i++)       for (int j = (1), _b = (m); j <= _b; j++)         if (a[i][j] == 1) {           hl[i][j] = hl[i][j - 1] + 1;           cl[i][j] = cl[i - 1][j] + 1;         } else {           hl[i][j] = 0;           cl[i][j] = 0;         }     for (int i = (n), _a = (1); i >= _a; i--)       for (int j = (m), _a = (1); j >= _a; j--)         if (a[i][j] == 1) {           hr[i][j] = hr[i][j + 1] + 1;           cr[i][j] = cr[i + 1][j] + 1;         } else {           hr[i][j] = 0;           cr[i][j] = 0;         }     for (int i = (1), _b = (q); i <= _b; i++) {       int s, x, y;       scanf( %d%d%d , &s, &x, &y);       if (s == 1) {         a[x][y] = 1 - a[x][y];         for (int j = (y), _b = (m); j <= _b; j++)           if (a[x][j]) {             hl[x][j] = hl[x][j - 1] + 1;           } else             hl[x][j] = 0;         for (int j = (y), _a = (1); j >= _a; j--)           if (a[x][j]) {             hr[x][j] = hr[x][j + 1] + 1;           } else             hr[x][j] = 0;         for (int i = (x), _b = (n); i <= _b; i++)           if (a[i][y]) {             cl[i][y] = cl[i - 1][y] + 1;           } else             cl[i][y] = 0;         for (int i = (x), _a = (1); i >= _a; i--)           if (a[i][y]) {             cr[i][y] = cr[i + 1][y] + 1;           } else             cr[i][y] = 0;       } else {         if (a[x][y] == 0) {           printf( 0 n );           continue;         }         int res = 0;         int l = x;         int r = x;         while (a[l - 1][y]) l--;         while (a[r + 1][y]) r++;         dem = 0;         for (int i = (l), _b = (r); i <= _b; i++) {           dem++;           h[dem] = hr[i][y];           if (i == x) mid = dem;         }         res = max(res, solve());         dem = 0;         for (int i = (l), _b = (r); i <= _b; i++) {           dem++;           h[dem] = hl[i][y];           if (i == x) mid = dem;         }         res = max(res, solve());         l = y;         r = y;         while (a[x][l - 1]) l--;         while (a[x][r + 1]) r++;         dem = 0;         for (int i = (l), _b = (r); i <= _b; i++) {           dem++;           h[dem] = cr[x][i];           if (i == y) mid = dem;         }         res = max(res, solve());         dem = 0;         for (int i = (l), _b = (r); i <= _b; i++) {           dem++;           h[dem] = cl[x][i];           if (i == y) mid = dem;         }         res = max(res, solve());         printf( %d n , res);       }     }   }