#include <bits/stdc++.h>
using namespace std;
int n;
int a[1005][1005];
char ans[1000010];
int main() {
  while (scanf("%d", &n) != EOF) {
    int now = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        scanf("%d", &a[i][j]);
      }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) now += a[i][j] * a[j][i];
    }
    now %= 2;
    int q;
    scanf("%d", &q);
    int t1, t2;
    int tops = 0;
    while (q--) {
      scanf("%d", &t1);
      if (t1 != 3) {
        scanf("%d", &t2);
        now = 1 - now;
      } else {
        ans[tops++] = '0' + now;
      }
    }
    ans[tops++] = '\0';
    printf("%s\n", ans);
  }
  return 0;
}
