#include <bits/stdc++.h>
char ansStr[1000000];
int nextInt() {
  char ch;
  int s, x;
  do {
    ch = getchar();
  } while (ch <= 32);
  if (ch == '-') {
    s = -1;
    ch = getchar();
  } else
    s = 1;
  x = 0;
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return s * x;
}
int main(void) {
  int i, j;
  int n, ans, q, cnt;
  n = nextInt();
  ans = 0;
  for (i = 0; i < n * n; i++) {
    int a;
    a = nextInt();
    if (i % (n + 1) == 0) ans ^= a;
  }
  q = nextInt();
  cnt = 0;
  while (q--) {
    int t;
    t = nextInt();
    if (t == 3)
      ansStr[cnt++] = '0' + ans;
    else {
      nextInt();
      ans ^= 1;
    }
  }
  puts(ansStr);
  return 0;
}
