#include <iostream>
using namespace std;
int main() {
int k;
double n;
cin >> k;
for (int i = 0; i < k; i++) {
cin >> n;
bool p = true;
while (n > 1) {
n /= (p ? 9 : 2);
p = !p;
}
cout << p + 1 << "\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluKCkgewogICAgaW50IGs7CiAgICBkb3VibGUgbjsKICAgIGNpbiA+PiBrOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBrOyBpKyspIHsKICAgICAgICBjaW4gPj4gbjsKICAgICAgICBib29sIHAgPSB0cnVlOwogICAgICAgIHdoaWxlIChuID4gMSkgewogICAgICAgICAgICBuIC89IChwID8gOSA6IDIpOwogICAgICAgICAgICBwID0gIXA7CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgcCArIDEgPDwgIlxuIjsKICAgIH0KICAgIHJldHVybiAwOwp9