#include <bits/stdc++.h>
using namespace std;
int nxt() {
  int x;
  cin >> x;
  return x;
}
void solve() {
  int n = nxt();
  cin.ignore();
  string s;
  cin >> s;
  if (n % 2) {
    for (int i = 0; i < n; i += 2)
      if (int(s[i] - '0') % 2) {
        cout << "1\n";
        return;
      }
    cout << "2\n";
    return;
  } else {
    for (int i = 1; i < n; i += 2)
      if (int(s[i] - '0') % 2 == 0) {
        cout << "2\n";
        return;
      }
    cout << "1\n";
    return;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int Q = 1;
  cin >> Q;
  while (Q--) {
    solve();
  }
  return 0;
}
