#include <bits/stdc++.h>
using namespace std;
int n, a[1111][1111], ans, q, id, k;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  for (int i = 1; i <= n; i++)
    if (a[i][i] == 1) ans ^= 1;
  cin >> q;
  while (q--) {
    scanf("%d", &id);
    if (id == 1 || id == 2) {
      scanf("%d", &k);
      ans ^= 1;
    }
    if (id == 3) {
      printf("%d", ans);
    }
  }
  printf("\n");
}
