var
n,m,a,b,c,d,he,x,y:longint;
q:array[0..1670000]of integer;
begin
assign(input,'ariprog.in');
assign(output,'ariprog.out');
reset(input);
rewrite(output);
readln(n);
readln(m);
for a:=0 to m do
for b:=a to m do
q[a*a+b*b]:=1;
c:=2*m*m+1;
for a:=1 to n do
begin
dec(c);
while q[c]=0 do dec(c);
end;
for b:=1 to trunc(2*m*m/(n-1)) do
for a:=0 to c do
if q[a]=1 then
begin
x:=0;
he:=a;
for d:=1 to n-1 do
begin
he:=he+b;
if q[he]=0 then
begin
x:=1;
break;
end;
end;
if x=0 then
begin
y:=1;
writeln(a,' ',b);
end;
end;
if y=0 then writeln('NONE');
close(input);
close(output);
end.