import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.io.*;
class Student {
String id;
String name;
String birth;
double score;
public Student(String id,String name,String birth,double score) {
this.birth=birth;
this.id=id;
this.name=name;
this.score=score;
}
@Override
public String toString() {
return "Student [id=" + id + ", name=" + name + ", birthday=" + birth + ", score=" + score + "]";
}
}
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Map<String,Student> stu = new TreeMap<>();
for(int i=0;i<n;i++) {
String id = sc.next();
String name = sc.next();
String birth = sc.next();
String []temp = birth.split("-");
birth = temp[0]+"年"+temp[1]+"月"+temp[2]+"日";
double score = sc.nextDouble();
Student s = new Student(id,name,birth,score);
if(stu.containsKey(id)) {
stu.replace(id, s);
}
else stu.put(id, s);
}
for(Map.Entry<String,Student> entry : stu.entrySet()) {
System.out.println(entry.getValue().toString());
}
sc.close();
}
}