#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > AdjList;
priority_queue<pair<int, pair<int, int> > > Edgelist;
int n, j, k, m, l, t, i;
string s, ss;
int a[1050][1050];
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  for (i = 0; i < n; i++) {
    t += a[i][i] * a[i][i];
  }
  scanf("%d", &k);
  while (k--) {
    scanf("%d", &n);
    if (n == 3) {
      printf("%d", t % 2);
    } else {
      scanf("%d", &m);
      t++;
    }
  }
  return 0;
}
