#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d", &n);
  bool grid[n + 1][n + 1], ans = false;
  string s;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) scanf("%d", &grid[i][j]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      ans ^= (grid[j][i] && grid[i][j]);
    }
  }
  scanf("%d", &q);
  while (q--) {
    int t;
    scanf("%d", &t);
    if (t == 1 || t == 2) {
      scanf("%d", &t);
      ans ^= 1;
    } else
      s += (ans + '0');
  }
  printf("%s", s.c_str());
  return 0;
}
