import java.util.*;class M{public static void main(String[]a){Scanner x=new Scanner(System.in);int t=x.nextInt(),i=0;while(++i<=t){String s=x.next();System.out.println(i+" \""+(new StringBuffer(s).reverse().toString().equals(s)?"YES\"":"NO\""));}}}
Mereço uma camiseta do alura! :D