#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  scanf("%d", &n);
  int scalar = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) {
      int x;
      scanf("%d", &x);
      if (i == j) scalar = (scalar + x) % 2;
    }
  int q;
  scanf("%d", &q);
  char ans[1000001] = {0};
  int cur = 0;
  for (int i = 0; i < q; ++i) {
    int t;
    scanf("%d", &t);
    if (t == 3)
      ans[cur++] = '0' + scalar;
    else {
      int x;
      scanf("%d", &x);
      scalar = 1 - scalar;
    }
  }
  printf("%s", ans);
  return 0;
}
