var
a:array[1947..2009]of longint;
b,c,d,n:longint;
st,str:string;
s:array[1947..2009]of string;
begin
assign(input,'nba.in');
assign(output,'nba.out');
reset(input);
rewrite(output);
readln(n);
for n:=1 to n do
begin
str:='';
readln(st);
b:=1;
while (st[b]>'9')or(st[b]<'0') do
begin
str:=str+st[b];
inc(b);
end;
c:=1;d:=0;
for b:=length(st) downto b do
begin
d:=d+(ord(st[b])-48)*c;
c:=c*10;
end;
a[d]:=1;
s[d]:=str;
end;
for b:=1947 to 2009 do
if a[b]=1 then writeln(b,' ',s[b]);
close(input);close(output);
end.