#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
int main() {
  int n;
  cin >> n;
  bool a = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      bool x;
      cin >> x;
      if (i == j) a ^= x;
    }
  int q;
  cin >> q;
  for (; q; q--) {
    int t;
    scanf("%d", &t);
    if (t == 3)
      printf("%d", (int)a);
    else {
      int x;
      scanf("%d", &x);
      a = !a;
    }
  }
  return 0;
}
