#include using namespace std; #ifdef _RUTHEN #include "debug.hpp" #else #define show(...) true #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) template using V = vector; int main() { ios::sync_with_stdio(false); cin.tie(0); int tt; cin >> tt; while (tt--) { string X, Y; cin >> X >> Y; string XY = X + Y, YX = Y + X; if (XY < YX) { cout << 'Y' << '\n'; } else if (XY > YX) { cout << 'X' << '\n'; } else { if (X.size() < Y.size()) { cout << 'Y' << '\n'; } else { cout << 'X' << '\n'; } } } return 0; }