import std; void main() { int T; readf("%d\n", T); string f(string x, string y) { string u = x ~ y, v = y ~ x; if (u > v) return "X"; else if (u < v) return "Y"; auto a = x.length, b = y.length; if (a > b) return "X"; else return "Y"; } foreach (_; 0 .. T) { string x, y; readf("%s\n%s\n", x, y); f(x, y).writeln; } }