#include <bits/stdc++.h>
using namespace std;
void solve();
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC * 1000 << " ms"
       << "\n";
  return 0;
}
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long r = 0;
  long long b = 0;
  for (long long i = 0; i < n; i++) {
    if (i % 2 == 0) {
      if (s[i] & 1) r++;
    } else {
      if (!(s[i] & 1)) b++;
    }
  }
  if (n % 2 == 0) {
    if (b > 0) {
      cout << 2;
    } else {
      cout << 1;
    }
  } else {
    if (r > 0) {
      cout << 1;
    } else {
      cout << 2;
    }
  }
}
