#include using namespace std; using ll=long long; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int Q; cin>>Q; maph2d; for(int i=10;i<16;i++){ h2d['a'+i-10]=i; } for(int i=0;i<10;i++){ h2d[i+'0']=i; } while(Q--){ string S; cin>>S; if(S.size()<2){ cout<