#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1e9 + 7;
void solve() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  if (N % 2 == 1) {
    for (int i = 0; i < N; i += 2) {
      if ((S[i] - '0') % 2 == 1) {
        cout << 1 << '\n';
        return;
      }
    }
    cout << 2 << '\n';
  } else {
    for (int i = 1; i < N; i += 2) {
      if ((S[i] - '0') % 2 == 0) {
        cout << 2 << '\n';
        return;
      }
    }
    cout << 1 << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
}
