#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main() { int t; cin >> t; while (t--) { string x, y; cin >> x >> y; int mini = min(x.size(), y.size()); int maxi = max(x.size(), y.size()); bool ok = false; for(int i = 0; i < mini; i++) { if(x[i] < y[i]) { cout << "Y" << endl; ok = true; break; } if(x[i] > y[i]) { cout << "X" << endl; ok = true; break; } } if(ok) { continue; } while(x.size() < maxi) { x.push_back('A'); } while(y.size() < maxi) { y.push_back('A'); } for(int i = 0; i < maxi; i++) { if(x[i] < y[i]) { cout << "Y" << endl; ok = true; break; } if(x[i] > y[i]) { cout << "X" << endl; ok = true; break; } } } return 0; }