#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int a[1100];
int main() {
  int n, q;
  while (scanf("%d", &n) != EOF) {
    int sum = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        int x;
        scanf("%d", &x);
        if (i == j) {
          a[i] = x;
          sum += x;
        }
      }
    sum %= 2;
    scanf("%d", &q);
    while (q--) {
      int op;
      scanf("%d", &op);
      if (op <= 2) {
        int r;
        scanf("%d", &r);
        sum = 1 - sum;
      } else {
        putchar(sum + '0');
      }
    }
    puts("");
  }
}
