#include <bits/stdc++.h>
using namespace std;
int times2[1020];
int a[1020][1020];
int n;
int getnum() {
  int i, j, k;
  int sum = 0;
  for (i = 1; i <= n; i++) sum ^= a[i][i];
  sum %= 2;
  return sum;
}
int main() {
  scanf("%d", &n);
  int i, j, k;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  int num;
  scanf("%d", &num);
  memset(times2, 0, sizeof(times2));
  int cou = getnum();
  while (num--) {
    int doip;
    int x;
    scanf("%d", &doip);
    if (doip == 3) {
      printf("%d", cou);
    } else {
      scanf("%d", &x);
      cou ^= 1;
    }
  }
  cout << endl;
  return 0;
}
