#include <bits/stdc++.h>
using namespace std;
int a[1100][1100], N, M, i, j, ans, x;
int main() {
  scanf("%d", &N);
  for (i = 1; i <= N; i++)
    for (j = 1; j <= N; j++) scanf("%d", &a[i][j]);
  for (i = 1; i <= N; i++)
    for (j = 1; j <= N; j++) ans ^= a[i][j] * a[j][i];
  scanf("%d", &M);
  while (M--) {
    int o, x;
    scanf("%d", &o);
    if (o == 3)
      printf("%d", ans);
    else {
      scanf("%d", &x);
      ans ^= 1;
    }
  }
}
