#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d", &n);
  vector<int> v(n);
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) scanf("%d", &v[j]);
    cnt ^= v[i];
  }
  for (scanf("%d", &q); q > 0; --q) {
    int c, x;
    scanf("%d", &c);
    if (c == 3) {
      printf("%d", cnt);
    } else {
      scanf("%d", &x);
      cnt ^= 1;
    }
  }
  printf("\n");
}
