#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
int Mat[1003][1003];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int sum = 0;
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j) {
        scanf("%d", &Mat[i][j]);
        if (i == j) sum = sum ^ Mat[i][j];
      }
    int q;
    scanf("%d", &q);
    for (int i = 1; i <= q; ++i) {
      int u, v;
      scanf("%d", &u);
      if (u == 1) {
        scanf("%d", &v);
        sum = 1 - sum;
        continue;
      }
      if (u == 2) {
        scanf("%d", &v);
        sum = 1 - sum;
        continue;
      }
      if (u == 3) {
        printf("%d", sum);
      }
    }
    printf("\n");
  }
}
