import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void main()
{
    auto T = readln.chomp.to!int;
    foreach (_; 0..T) {
        auto N = readln.chomp.to!int;
        auto D = readln.chomp;
        if (N%2 == 1) {
            for (int i = 0; i < N; i+=2) {
                if ((D[i]-'0')%2 == 1) {
                    writeln(1);
                    goto end;
                }
            }
            writeln(2);
        } else {
            for (int i = 1; i < N; i += 2) {
                if ((D[i]-'0')%2 == 0) {
                    writeln(2);
                    goto end;
                }
            }
            writeln(1);
        }
        end:
    }
}