#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, w;
  string s;
  cin >> t;
  while (t--) {
    cin >> n >> s;
    bool flag = 0;
    if (n % 2) {
      for (int i = 0; i < n; i += 2) {
        if ((s[i] - '0') % 2) {
          flag = 1;
          break;
        }
      }
      w = flag ? 1 : 2;
      cout << w << endl;
    } else {
      for (int i = 1; i < n; i += 2) {
        if ((s[i] - '0') % 2 == 0) {
          flag = 1;
          break;
        }
      }
      w = flag ? 2 : 1;
      cout << w << endl;
    }
  }
}
