var
n,i,j,max,k: Integer;
lname, name: array [1..100000] of String;
y,g,a:array [1..100000] of longint;
begin
Read(n);
for i:=1 to n do
begin
read(lname[i]);
read (name[i]);
read(y[i],g[i]);
if (max
max:=g[i];
end;
for i:=1 to n do
if g[i]=max then
begin
writeln(lname[i], ' ', name[i]);
j:=j+1;
a[j]:=i;
end;
for i:=1 to j do
write(g[a[i]], ' ');
end.