#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000 + 321;
const int mod = 1000 * 1000 * 1000 + 7;
int a[maxN][maxN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) scanf("%d", &a[i][j]);
  int sum = 0;
  for (int i = 0; i < n; i++) sum ^= a[i][i];
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int t;
    scanf("%d", &t);
    if (t == 3) {
      printf("%d", sum);
    } else {
      int d;
      scanf("%d", &d);
      sum ^= 1;
    }
  }
  printf("\n");
  return 0;
}
