#include <bits/stdc++.h>
using namespace std;
long long t, n;
string s;
bool u1, u2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n >> s;
    u1 = 0;
    u2 = 0;
    for (int i = 0; i <= n - 1; i++) {
      if (i % 2 == 0 && (s[i] - '0') % 2 == 1) u1 = 1;
      if (i % 2 == 1 && (s[i] - '0') % 2 == 0) u2 = 1;
    }
    if ((n % 2 == 0 && u2) || (n % 2 == 1 && !u1))
      cout << 2;
    else
      cout << 1;
    cout << endl;
  }
  return 0;
}
