#include <bits/stdc++.h>
void scan(int* i) {
  int t = 0;
  char c;
  bool negative = false;
  c = getchar_unlocked();
  while (c < '0' || c > '9') {
    if (c == '-') negative = true;
    c = getchar_unlocked();
  }
  while (c >= '0' && c <= '9') {
    t = (t << 3) + (t << 1) + c - '0';
    c = getchar_unlocked();
  }
  if (negative) t = ~(t - 1);
  *i = t;
}
void scan(long long int* i) {
  long long int t = 0;
  char c;
  bool negative = false;
  c = getchar_unlocked();
  while (c < '0' || c > '9') {
    if (c == '-') negative = true;
    c = getchar_unlocked();
  }
  while (c >= '0' && c <= '9') {
    t = (t << 3) + (t << 1) + c - '0';
    c = getchar_unlocked();
  }
  if (negative) t = ~(t - 1);
  *i = t;
}
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    std::cout << v << " ";
    return *this;
  }
} dbg;
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  std::string delim = "[";
  for (unsigned int i = 0; i < v.size(); i++) {
    os << delim << v[i];
    delim = ", ";
  }
  return os << "]";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::set<T>& v) {
  std::string delim = "[";
  for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    os << delim << *ii;
    delim = ", ";
  }
  return os << "]";
}
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::map<T1, T2>& v) {
  std::string delim = "[";
  for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    os << delim << *ii;
    delim = ", ";
  }
  return os << "]";
}
using namespace std;
int T;
int main(int argc, char const* argv[]) {
  int n, u, t;
  scan(&n);
  vector<vector<int> > a(n, vector<int>(n, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scan(&a[i][j]);
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += a[i][i];
  }
  ans %= 2;
  int q;
  scan(&q);
  for (int i = 0; i < q; i++) {
    scan(&t);
    if (t == 3) {
      printf("%d", ans);
    } else {
      scan(&u);
      ans = 1 - ans;
    }
  }
  printf("\n");
  return 0;
}
