#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string st;
  cin >> st;
  bool ev = false, od = false;
  for (int i = 0; i < n; i++) {
    if (st[i] % 2 == 1 and i % 2 == 0)
      od = true;
    else if (st[i] % 2 == 0 and i % 2 == 1)
      ev = true;
  }
  if (n & 1) {
    if (od) {
      cout << "1\n";
    } else
      cout << "2\n";
  } else {
    if (ev)
      cout << "2\n";
    else
      cout << "1\n";
  }
}
int main() {
  int tc;
  cin >> tc;
  while (tc--) solve();
}
