#include <bits/stdc++.h>
using namespace std;
int n, q, t, a, r;
int sum;
int M[1010][1010];
char R[1000010];
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (n); ++j) scanf("%d", &M[i][j]);
  for (int i = (0); i < (n); ++i) sum = (sum + M[i][i]) % 2;
  scanf("%d", &q);
  for (int i = (0); i < (q); ++i) {
    scanf("%d", &t);
    if (t == 3) {
      R[r++] = '0' + sum;
    } else {
      scanf("%d", &a);
      sum = 1 - sum;
    }
  }
  printf("%s\n", R);
  return 0;
}
