#include #include using namespace std; using namespace atcoder; using mint = modint998244353; using ll = long long; #define all(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < n; i++) void solve(void){ string x, y; cin >> x >> y; if(x + y > y + x){ cout << 'X' << endl; } else if(x + y < y + x){ cout << 'Y' << endl; } else if(x.length() > y.length()){ cout << 'X' << endl; } else cout << 'Y' << endl; } int main(void) { int t; cin >> t; rep(i, t){ solve(); } return 0; }