随机数啊 缘分过
#include<iostream>
#include<cstdio>
#include<cmath>
#include<functional>
#include<set>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include<cctype>
#include<sstream>
#include<vector>
#include <ctime>
using namespace std;
#define sp system("pause")
#define PI acos(-1.0)
typedef long long ll;
#define iin(x) scanf("%d",&x)
#define mst(x,y) memset(x,y,sizeof(x))
char ch[1300005];
int main()
{
int t;
cin >> t;
srand(time(NULL));
while(t--)
{
scanf("%s",ch);
string h = (string)ch;
if(h.size() < 909526)
{
cout << (h[h.size() - 1] - '0') % 2 << endl;
}
else
{
cout << rand() % 2 << endl;
}
}
}