import java.io.*;
import java.lang.*;
class Student
{
public int num;
public double score;
public double weight;
public String name;
public int age;
}
class paixu
{
public static void main(String args[])throws IOException
{
Student k;
int i,j,m,n,p,q;
String str =new String();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("1:age(z->a) 2:age(a->z) 3:num(z->a) 4:num(a->z) 5:end");
for(q=0;q<99;q++)
{ str=br.readLine();
p=Integer.parseInt(str);
if(p==1)
{System.out.print("Please enter the number of student:");
str=br.readLine();
n=Integer.parseInt(str);
Student stu[];
stu=new Student[n];
for(i=0;i<n;i++)//输入
{
stu[i]=new Student();
str=br.readLine();
m=Integer.parseInt(str);
stu[i].age=m;
}
for(j=0;j<n-1;j++)//排序
{
for(i=0;i<n-j-1;i++)
{
if(stu[i].age<stu[i+1].age)
{
k=stu[i];
stu[i]=stu[i+1];
stu[i+1]=k;
}
}
}
System.out.print("the ages are:");//输出
for(i=0;i<n;i++)
{
System.out.print(stu[i].age+" ");
}
}
if(p==2)
{System.out.print("Please enter the number of student:");
str=br.readLine();
n=Integer.parseInt(str);
Student stu[];
stu=new Student[n];
for(i=0;i<n;i++)//输入
{
stu[i]=new Student();
str=br.readLine();
m=Integer.parseInt(str);
stu[i].age=m;
}
for(j=0;j<n-1;j++)//排序
{
for(i=0;i<n-j-1;i++)
{
if(stu[i].age>stu[i+1].age)
{
k=stu[i];
stu[i]=stu[i+1];
stu[i+1]=k;
}
}
}
System.out.print("the ages are:");//输出
for(i=0;i<n;i++)
{
System.out.print(stu[i].age+" ");
}}
if(p==3)
{
System.out.print("Please enter the number of student:");
str=br.readLine();
n=Integer.parseInt(str);
Student stu[]=new Student[n];
for( i = 0;i<n;i++){
str = br.readLine();
stu[i] =new Student();
stu[i].num = Integer.parseInt(str);
}
Student t = new Student();
for(i=0;i<n;i++)
{
for( j=0;j<n-1-i;j++)
if(stu[j].num<stu[j+1].num)
{t=stu[j+1];
stu[j+1]=stu[j];
stu[j]=t;}}
for( i=0;i<n;i++)
System.out.print(stu[i].num+" ");
}
if(p==4)
{
System.out.print("Please enter the number of student:");
str=br.readLine();
n=Integer.parseInt(str);
Student stu[]=new Student[n];
for( i = 0;i<n;i++){
str = br.readLine();
stu[i] =new Student();
stu[i].num = Integer.parseInt(str);
}
Student t = new Student();
for(i=0;i<n;i++)
{
for( j=0;j<n-1-i;j++)
if(stu[j].num>stu[j+1].num)
{t=stu[j+1];
stu[j+1]=stu[j];
stu[j]=t;}}
for( i=0;i<n;i++)
System.out.print(stu[i].num+" ");
}
if(p==5)
{break;}
}
}
}