import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i = 0; i < t; i++){ String x = sc.next(); String y = sc.next(); int p = (x + y).compareTo(y + x); if(p > 0){ System.out.println("X"); } else if (p < 0){ System.out.println("Y"); } else{ if(x.length() > y.length()){ System.out.println("X"); } else{ System.out.println("Y"); } } } } }