#include <bits/stdc++.h>
using namespace std;
int a[1010][1010];
int b[1010];
char str[1000010];
int main() {
  int n;
  int p;
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) scanf("%d", &a[i][j]);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
      b[i] = a[i][i];
      ans += b[i];
    }
    ans %= 2;
    int cnt = 0;
    scanf("%d", &p);
    int type;
    int x;
    while (p--) {
      scanf("%d", &type);
      if (type == 1 || type == 2) {
        scanf("%d", &x);
        ans ^= 1;
      } else {
        str[cnt++] = ans + '0';
      }
    }
    str[cnt] = 0;
    printf("%s\n", str);
  }
  return 0;
}
