#include <bits/stdc++.h>
using namespace std;
int main() {
  int s = 0;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int c;
      scanf("%d", &c);
      if (i == j) s = (s + c) % 2;
    }
  }
  int m;
  scanf("%d", &m);
  for (int q = 0; q < m; q++) {
    int c;
    scanf("%d", &c);
    if (c == 3) {
      printf("%d", s);
    } else {
      int k;
      scanf("%d", &k);
      s = (s + 1) % 2;
    }
  }
}
