#include <bits/stdc++.h>
using namespace std;
int getint() {
  int s = 0, o = 1;
  char c;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') o = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) s *= 10, s += c - '0';
  return s * o;
}
const int maxn = 1010;
int n, m, o, x, r;
int a[maxn][maxn], b[maxn], c[maxn], d[maxn];
int main(int argc, char const *argv[]) {
  n = getint();
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) a[i][j] = getint();
  for (int i = 0; i < n; i++) r ^= a[i][i];
  m = getint();
  for (int mm = 0; mm < m; mm++) {
    o = getint();
    if (o == 3)
      printf("%d", r);
    else {
      x = getint();
      r ^= 1;
    }
  }
  return 0;
}
