#include <iostream> #include<vector> #include<algorithm> using namespace std; struct student { string name; int age; int score; }; bool func(student a,student b) { if(a.score!=b.score)return a.score<b.score; else if(a.name!=b.name)return a.name<b.name; else return a.age<b.age; } void Myprint(student s) { cout<<s.name<<" "<<s.age<<" "<<s.score<<endl; } int main() { int n; student s; while(cin>>n) { vector<student>v; for(int i=0;i<n;i++) { cin>>s.name; cin>>s.age; cin>>s.score; v.push_back(s); } sort(v.begin(),v.end(),func); for_each(v.begin(),v.end(),Myprint); } return 0; } // 64 位输出请用 printf("%lld")