import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
while(sc.hasNext())
{
int n=sc.nextInt();
student[] p=new student[n];
for(int i=0;i<n;i++)
{
String name=sc.next();
int age=sc.nextInt();
int sore=sc.nextInt();
p[i]=new student();
p[i].FZ(name,age,sore);
}
student t=new student();
for(int i=0;i<n-1;i++)
{
for(int j=0;j<n-i-1;j++)
{
if(p[j].sore>p[j+1].sore)
{
t=p[j];
p[j]=p[j+1];
p[j+1]=t;
}
else if(p[j].sore==p[j+1].sore)
{
if(p[j].name.charAt(0)>p[j+1].name.charAt(0))
{
t=p[j];
p[j]=p[j+1];
p[j+1]=t;
}
}
}
}
for(int i=0;i<n;i++)
{
p[i].speak();
}
}
}
}
class student
{
String name;
int age;
int sore;
void FZ(String name,int age,int sore)
{
this.name=name;
this.age=age;
this.sore=sore;
}
void speak()
{
System.out.println(name+" "+age+" "+sore);
}
}
yeyeyy
相关分类