import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int t = input.nextInt();
        input.nextLine();  // 消耗掉上一行输入后的换行符
        for(int i = 0; i < t; i++) {
            int n = input.nextInt();
            input.nextLine();  // 消耗掉上一行输入后的换行符
            String str = input.nextLine();
            StringBuffer reverse = new StringBuffer();
            for(int j = n - 1; j >= 0; j--) {
                reverse.append(str.charAt(j));
            }
            System.out.println(reverse.toString());
        }
    }
}