class Main
{
public static void main
(String[] args
) {
java.
util.
Scanner in
= new java.
util.
Scanner(System.
in); int k = in.nextInt();
double n;
for (int i = 0; i < k; i++)
{
n = in.nextInt();
boolean p = true;
while (n > 1)
{
n /= (p ? 9 : 2);
p = !p;
}
System.
out.
println((p
? 1 : 0) + 1); }
}
}
Y2xhc3MgTWFpbgp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykKCXsKCQlqYXZhLnV0aWwuU2Nhbm5lciBpbiA9IG5ldyBqYXZhLnV0aWwuU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCWludCBrID0gaW4ubmV4dEludCgpOwoJCWRvdWJsZSBuOwoJCWZvciAoaW50IGkgPSAwOyBpIDwgazsgaSsrKSAKCQl7CgkJCW4gPSBpbi5uZXh0SW50KCk7CgkJCWJvb2xlYW4gcCA9IHRydWU7CgkJCXdoaWxlIChuID4gMSkgCgkJCXsKCQkJCW4gLz0gKHAgPyA5IDogMik7CgkJCQlwID0gIXA7CgkJCX0KCQkJU3lzdGVtLm91dC5wcmludGxuKChwID8gMSA6IDApICsgMSk7CgkJfQoJfQp9