#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long int;
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a;
    }
    a = a * a;
    b >>= 1;
  }
  return res;
}
void solve() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  if (s.length() % 2 == 0) {
    for (ll i = 1; i < n; i += 2) {
      if ((s[i] - '0') % 2 == 0) {
        cout << 2 << "\n";
        return;
      }
    }
    cout << 1 << "\n";
  } else {
    for (ll i = 0; i < n; i += 2) {
      if ((s[i] - '0') % 2 == 1) {
        cout << 1 << "\n";
        return;
      }
    }
    cout << 2 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  ll t = 1;
  cin >> t;
  for (ll i = 1; i <= t; i++) {
    solve();
  }
}
