#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q, i, j, op;
  int x;
  bool sol = 0;
  string out;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) {
      scanf("%d", &x);
      if (i == j && x) sol = !sol;
    }
  }
  scanf("%d", &q);
  for (i = 0; i < q; ++i) {
    scanf("%d", &op);
    if (op == 3)
      out += ('0' + sol);
    else
      scanf("%d", &j), sol = !sol;
  }
  printf("%s\n", out.c_str());
}
