#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; void solver(string x, string y) { string s1 = x + y; string s2 = y + x; if (s1 > s2) { cout << "X" << endl; } else if (s1 < s2) { cout << "Y" << endl; } else { if (x.size() > y.size()) { cout << "X" << endl; } else { cout << "Y" << endl; } } } int main() { int T; cin >> T; for (int i = 0; i < T; ++i) { string x; string y; cin >> x; cin >> y; solver(x, y); } return 0; }