\clearpage \section{Problem: Meta-Loopless Sorts} \subsection*{Background} Sorting holds an important place in computer science. Analyzing and implementing various sorting algorithms forms an important part of the education of most computer scientists, and sorting accounts for a significant percentage of the world's computational resources. Sorting algorithms range from the bewilderingly popular Bubble sort, to Quicksort, to parallel sorting algorithms and sorting networks. In this problem you will be writing a program that creates a sorting program (a meta-sorter). \subsection*{The Problem} The problem is to create a program whose output is a standard Pascal program that sorts $n$ numbers where $n$ is the only input to the program you will write. The Pascal program generated by your program must have the following properties: \begin{itemize} \item It must begin with {\tt program sort(input,output);} \item It must declare storage for exactly $n$ {\tt integer} variables. The names of the variables must come from the first $n$ letters of the alphabet (a,b,c,d,e,f). \item A single {\tt readln} statement must read in values for all the integer variables. \item Other than {\tt writeln} statements, the only statements in the program are {\tt if then else} statements. The boolean conditional for each {\tt if} statement must consist of one strict inequality (either $<$ or $>$) of two integer variables. Exactly $n!$ {\tt writeln} statements must appear in the program. \item Exactly three semi-colons must appear in the program \begin{enumerate} \item after the program header: {\tt program sort(input,output);} \item after the variable declaration: {\tt \ldots : integer;} \item after the {\tt readln} statement: {\tt readln(\ldots);} \end{enumerate} \item No redundant comparisons of integer variables should be made. For example, during program execution, once it is determined that $a < b$, variables $a$ and $b$ should not be compared again. \item Every {\tt writeln} statement must appear on a line by itself. \item The program must compile. Executing the program with input consisting of any arrangement of any $n$ distinct integer values should result in the input values being printed in sorted order. \end{itemize} For those unfamiliar with Pascal syntax, the example at the end of this problem completely defines the small subset of Pascal needed. \subsection*{The Input} The input is a single integer $n$ on a line by itself with $1 \leq n \leq 6$. \subsection*{The Output} The output is a compilable standard Pascal program meeting the criteria specified above. \clearpage \subsection*{Sample Input} 3 \subsection*{Sample Output} \begin{verbatim} program sort(input,output); var a,b,c : integer; begin readln(a,b,c); if a < b then if b < c then writeln(a,b,c) else if a < c then writeln(a,c,b) else writeln(c,a,b) else if a < c then writeln(b,a,c) else if b < c then writeln(b,c,a) else writeln(c,b,a) end. \end{verbatim}