#include using namespace std; typedef unsigned int ui; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ldb; #define range(x) (x).begin(),(x).end() std::mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); inline int sj(int n) { unsigned int x=rnd(); return x%n+1; } #define rand fst template void read(register typC &x) { register int c=getchar(),fh=1; while ((c<48)||(c>57)) { if (c=='-') {c=getchar();fh=-1;break;} c=getchar(); } x=c^48;c=getchar(); while ((c>=48)&&(c<=57)) { x=x*10+(c^48); c=getchar(); } x*=fh; } template void read(register typC *a,int num) { for (register int i=1;i<=num;i++) read(a[i]); } template void read(typC &first, Args& ... args) { read(first); read(args...); } template void write(register typC x) { if (x<0) putchar('-'),x=-x; static int st[100]; register int tp=1; register typC y;st[1]=x%10;x/=10; while (x) y=x/10,st[++tp]=x-y*10,x=y;++tp; while (--tp) putchar(st[tp]|48); } template void write(register typC *a,register int num) { if (num<=0) puts(""); for (register int i=1;i<=num;i++) write(a[i]),putchar(i==num?10:32); } template typC ab(register typC x) { if (x<0) return -x; return x; } #define space(x) write(x),putchar(32) #define enter(x) write(x),putchar(10) #define debug(x,y) printf("%s: ",#x),write(x,y) const int p=998244353; const db eps=1e-9; inline void inc(register int &x,const int y) { if ((x+=y)>=p) x-=p; } inline void dec(register int &x,const int y) { if ((x-=y)<0) x+=p; } inline int ksm(register int x,register int y) { register int r=1; while (y) { if (y&1) r=(ll)r*x%p; x=(ll)x*x%p; y>>=1; } return r; } priority_queue ONLYYFORRCOPYY; priority_queue,greater > ONLYYFORRCOPYY__; struct Q { int u,v; Q(int a=0,int b=0):u(a),v(b){} bool operator<(const Q &o) const {return vm) swap(n,m); n=m-n; if (n==1) {puts("-1 -1");continue;} if (n==0) { if (m==1) puts("-1 -1"); else printf("%d %d\n",2,m); } else { m=sqrt(n); for (i=2;i<=m;i++) if (n%i==0) break; if (i<=m) printf("%d %d\n",i,n); else printf("%d %d\n",n,n); } } }