#include <bits/stdc++.h>
using namespace std;
int ans0[1000001];
int tail = 1;
int a[1001];
int n, m;
int ans = 0;
int main() {
  int i, j, k;
  int id;
  int xx, yy;
  int temp;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      scanf("%d", &temp);
      if (i == j) {
        a[i] = temp;
        if (temp == 1) {
          ans = 1 - ans;
        }
      }
    }
  }
  scanf("%d", &m);
  for (i = 1; i <= m; i++) {
    scanf("%d", &id);
    if (id == 1 || id == 2) {
      scanf("%d", &temp);
      ans = 1 - ans;
      a[temp] = 1 - a[temp];
    } else {
      ans0[tail] = ans;
      tail++;
    }
  }
  for (i = 1; i <= tail - 1; i++) {
    printf("%d", ans0[i]);
  }
  printf("\n");
  return 0;
}
