#include <bits/stdc++.h>
using namespace std;
long const md = 1000000007;
long const mx = 2147483647;
long const mm = 1743;
long const maxN = 10000;
long const di[8] = {-1, 1, 0, 0, 1, -1, 1, -1};
long const dj[8] = {0, 0, 1, -1, 1, -1, -1, 1};
double const eps = 1e-6;
long n, m, j, i, l, a[1050][1050], x;
char c;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  l = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (a[i][j] + a[j][i] == 2) l = l ^ 1;
  scanf("%d", &m);
  for (i = 1; i <= m; i++) {
    scanf("%d", &x);
    if (x == 3)
      printf("%d", l);
    else {
      scanf("%d", &x);
      l = l ^ 1;
    }
  }
}
