#include <bits/stdc++.h>
using namespace std;
int a[2005][2005];
int b[10005];
char res[2000055];
int main() {
  int ch, x;
  int n;
  int cnt = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
    if (a[i][i] == 1) {
      cnt++;
    }
  }
  for (int i = 0; i < 10; i++) {
  }
  for (int i = 0; i < 10; i++) {
  }
  cnt %= 2;
  int q;
  int p = 0;
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &ch);
    if (ch == 1 || ch == 2) {
      scanf("%d", &x);
      cnt++;
      cnt %= 2;
    } else {
      cnt = cnt % 2;
      res[p++] = cnt + '0';
      res[p] = '\0';
    }
  }
  for (int i = 0; i < 10; i++) {
  }
  printf("%s\n", res);
  return 0;
}
