public class Main {
            public static void main(String[] args) { 
              java.util.Scanner input = new java.util.Scanner(System.in) ;
              int n =input.nextInt();
            for(int j =0;j<n;j++){
                String a = input.next();
                int b = a.length()-1;
                for(int i=b;i>=0;i--){
                    String c= a.charAt(i)+"";
                    System.out.print(c);
                }
                System.out.println();
            }
        }
    }
/**************************************************************
	Problem: 2209
	User: admin
	Language: Java
	Result: Accepted
	Time:751 ms
	Memory:41880 kb
****************************************************************/