#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  int c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
long long int powmod(long long int a, int b, int n) {
  long long int rm = 1;
  while (b) {
    if (b % 2) {
      rm = (rm * a) % n;
    }
    a = (a * a) % n;
    b /= 2;
  }
  return rm;
}
int main() {
  int n, opt = 0, q, qtype;
  scanf("%d", &n);
  for (int r = 1; r <= n; ++r) {
    for (int c = 1; c <= n; ++c) {
      scanf("%d", &q);
      if (r == c) opt += q;
    }
  }
  scanf("%d", &q);
  opt %= 2;
  int cd = 0;
  while (q--) {
    scanf("%d", &qtype);
    if (qtype == 1) {
      scanf("%d", &n);
      opt = !opt;
    } else if (qtype == 2) {
      scanf("%d", &n);
      opt = !opt;
    } else {
      printf("%d", opt);
      cd = 1;
    }
  }
  if (cd) printf("\n");
  return 0;
}
