#include <bits/stdc++.h>
using namespace std;
int d, op, x, i, j, n;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) scanf("%d", &x), d += x * (i == j);
  d %= 2;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &op);
    if (op <= 2)
      scanf("%d", &x), d = 1 - d;
    else
      printf("%d", d);
  }
  return 0;
}
