#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
int A[1009][1009];
int main() {
  int n, q, i, j;
  scanf("%d", &n);
  int sum = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      scanf("%d", &A[i][j]);
    }
    sum ^= A[i][i];
  }
  scanf("%d", &q);
  string out = "";
  while (q--) {
    int tp;
    scanf("%d", &tp);
    if (tp == 3) {
      out += char(sum + '0');
    } else {
      scanf("%d", &i);
      sum ^= 1;
    }
  }
  puts(out.c_str());
}
