#include <bits/stdc++.h>
using namespace std;
int n, q;
int x[1005][1005];
int ans = 0;
int t1, t2;
int main() {
  scanf("%d", &n);
  for (int a = 0; a < n; a++)
    for (int b = 0; b < n; b++) scanf("%d", &x[a][b]);
  for (int a = 0; a < n; a++)
    for (int b = 0; b < n; b++) ans = (ans + x[a][b] * x[b][a]) % 2;
  scanf("%d", &q);
  for (int a = 0; a < q; a++) {
    scanf("%d", &t1);
    if (t1 == 3)
      printf("%d", ans);
    else {
      scanf("%d", &t2);
      ans = 1 - ans;
    }
  }
  printf("\n");
  return 0;
}
