#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--) { string x,y; cin >> x >> y; string X = x+y,Y = y+x; if(X == Y) { cout << ((x.size() < y.size())?"Y":"X") << '\n'; } else { cout << ((X < Y)?"Y":"X") << '\n'; } } }