#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 7;
const double eps = 1e-7;
const long long mod = 998244353;
const int INF = 0x3f3f3f3f;
int t, n;
char str[1005];
int main(int argc, char const *argv[]) {
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> (str + 1);
    int judge = 0;
    if (n % 2 == 0) {
      for (int i = 1; i <= n; i++) {
        if (i % 2 == 0) {
          if ((str[i] - '0') % 2 == 0) judge = 1;
        }
      }
      if (judge)
        cout << "2" << endl;
      else
        cout << "1" << endl;
    } else {
      for (int i = 1; i <= n; i++) {
        if (i % 2 == 1) {
          if ((str[i] - '0') % 2 == 1) judge = 1;
        }
      }
      if (judge)
        cout << "1" << endl;
      else
        cout << "2" << endl;
    }
  }
  return 0;
}
