#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  string v;
  cin >> n >> v;
  if (n % 2 == 0) {
    for (int i = 1; i < n; i += 2) {
      if (v.at(i) % 2 == 0) {
        cout << 2 << "\n";
        return;
      }
    }
    cout << 1 << "\n";
  } else {
    for (int i = 0; i < n; i += 2) {
      if (v.at(i) % 2 != 0) {
        cout << 1 << "\n";
        return;
      }
    }
    cout << 2 << "\n";
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
