#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
int a[MAXN][MAXN], n, q, i, j, sol;
int main() {
  sol = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    for (j = 0; j < i; j++) scanf("%*d");
    scanf("%d", &q);
    sol ^= q;
    for (j = i + 1; j < n; j++) scanf("%*d");
  }
  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    scanf("%d", &j);
    if (j == 3)
      printf("%d", sol);
    else {
      scanf("%*d");
      sol ^= 1;
    }
  }
  printf("\n");
  return 0;
}
