program nba;
var
h:array [1947..2009] of string;
n:longint;
f1,f2:text;
procedure init;
var i,j,k:longint; str:string;
begin
assign(f1,'nba.in'); reset(f1);
assign(f2,'nba.out'); rewrite(f2);
readln(f1,n);
for i:=1947 to 2009 do h[i]:='*';
for i:=1 to n do begin
readln(f1,str);
val(copy(str,pos(' ',str)+1,4),k);
h[k]:='';
for j:=1 to length(str) do
if str[j]=' ' then break
else h[k]:=h[k]+str[j];
end;
end;
procedure print;
var i:longint;
begin
for i:=1947 to 2009 do
if h[i]<>'*' then writeln(f2,i,' ',h[i]);
close(f2);
end;
begin
init;
print;
end.