#include <bits/stdc++.h>
using namespace std;
void data() {
  freopen("data.in", "r", stdin);
  freopen("data.out", "w", stdout);
}
int a[1002][1002], n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j) scanf("%d", &a[i][j]);
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) ans += a[i][j] * a[j][i];
  ans %= 2;
  int m;
  scanf("%d", &m);
  for (int i = 0; i < (m); ++i) {
    int a, b;
    scanf("%d", &a);
    if (a == 3)
      printf("%d", ans);
    else {
      scanf("%d", &b);
      ans = 1 - ans;
    }
  }
  printf("\n");
  return 0;
}
