program huandengpian;
uses sysutils;
var
biaozhi:array[1..26] of boolean;
q,x,y,xmin,xmax,ymin,ymax,jilu:array[1..26] of integer;
i,t,n:integer;
time:real;
procedure sousuo(k:integer);
var
z:integer;
begin
if now*86400-time>0.95 then
begin
if t=1 then
begin
for i:=1 to n do
begin
write (chr((ord('A')+i-1)),' ');
writeln (jilu[i])
end
end
else
writeln ('None');
close (input);
close (output);
halt
end;
for z:=1 to n do
if (biaozhi[z]=true) and (x[z]>=xmin[k])
and(x[z]<=xmax[k]) and (y[z]>=ymin[k])and(y[z]<=ymax[k]) then
begin
q[k]:=z;
biaozhi[z]:=false;
if k=n then
begin
t:=t+1;
if t>1 then
begin
writeln ('None');
close (input);
close (output);
halt
end
else
for i:=1 to n do
jilu[i]:=q[i];
end
else
sousuo (k+1);
biaozhi[z]:=true
end
end;
begin
assign (input,'slides.in');
reset (input);
assign (output,'slides.out');
rewrite (output);
time:=now*86400;
readln (n);
for i:=1 to n do
readln (xmin[i],xmax[i],ymin[i],ymax[i]);
for i:=1 to n do
readln (x[i],y[i]);
for i:=1 to n do
biaozhi[i]:=true;
sousuo(1);
if t=1 then
begin
for i:=1 to n do
begin
write (chr((ord('A')+i-1)),' ');
writeln (jilu[i])
end
end
else
writeln ('None');
close (input);
close (output)
end.