/*
ID: superlo1
PROG: ariprog
LANG: C++
*/
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int n, m;
bool mm[250*250*2+1];
int list[250*250*2+1], maxx, len;
int main(){
freopen("ariprog.in","r",stdin);
freopen("ariprog.out","w",stdout);
scanf("%d %d", &n, &m);
maxx = 2*m * m + 1;
len = 0;
memset(mm, 0, sizeof(mm));
for(int i = 0; i <= m; i ++){
for(int j = i; j <= m; j ++){
int temp = i*i + j*j;
if(mm[temp]) continue;
mm[temp] = 1;
list[len++] = temp;
}
}
sort(list, list + len);
bool found = false;
for(int i = 1; i*(n-1) < maxx; i++ ){
for(int j = 0; list[j]+(n-1)*i<maxx && j < len; j ++){
bool tp = false;
for(int k = n - 1; k >= 0; k --){
if(!mm[list[j]+k*i]){
tp = true;
break;
}
}
if(!tp){
found = true;
printf("%d %d\n", list[j], i);
}
}
}
if(!found)
puts("NONE");
}