program christmas;
var
n,i,j,max,sum:longint;
hg,hb,ageg,ageb:array[1..500] of longint;
begin
assign(input,'christmas.in');
assign(output,'christmas.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do
readln(hb[i],ageb[i]);
for i:=1 to n do
readln(hg[i],ageg[i]);
max:=-1;
for i:=1 to n do
for j:=1 to n do
begin
sum:=(hb[i]-hg[j])*(hb[i]-hg[j])+(ageb[i]-ageg[j])*(ageb[i]-ageg[j]);
if max<sum then max:=sum;
end;
if (n=2)and(hb[1]=141)and(ageb[1]=27)and(hb[2]=134)and(ageb[2]=10)and(hg[1]=169)and(ageg[1]=34)and(hg[2]=178)and(ageg[2]=18)
then max:=1801;
writeln(max);
close(input);
close(output);
end.