// Arup Guha
// 7/21/2014
// Solution to 2004 MCPC Problem C: Symmetric Order

import java.util.*;

public class c {

    public static void main(String[] args) {

        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int loop = 1;

        // Process each case.
        while (n != 0) {

            // Get input.
            String[] inp = new String[n];
            for (int i=0; i<n; i++)
                inp[i] = stdin.next();

            // Shuffle into a new array.
            String[] ans = new String[n];
            for (int i=0,j=0; i<n; i+=2,j++) {
                ans[j] = inp[i];
                if (i+1 < n) ans[n-j-1] = inp[i+1];
            }

            // Print it.
            System.out.println("SET "+loop);
            for (int i=0; i<n; i++)
                System.out.println(ans[i]);

            // Go to the next case.
            loop++;
            n = stdin.nextInt();
        }
    }
}
