#include <bits/stdc++.h>
using namespace std;
const int maxn = 1111125;
int res[maxn], sz;
int a[1111][1111];
int T[1111][2][2];
int R[maxn], C[maxn];
int main() {
  ios::sync_with_stdio(false);
  int n, i, j;
  int ans = 0;
  cin >> n;
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= n; ++j) {
      cin >> a[i][j];
    }
  }
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= n; ++j) {
      ans = ans + a[i][j] * a[j][i];
      ans &= 1;
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int t, x;
    cin >> t;
    if (t ^ 3) {
      cin >> x;
      ans ^= 1;
    } else {
      res[sz++] = ans;
    }
  }
  for (i = 0; i < sz; ++i) {
    cout << res[i];
  }
  cout << endl;
  return 0;
}
