from sys import stdin input=lambda :stdin.readline()[:-1] def quotient_range(n): ret=[] i=1 while i<=n: q=n//i j=n//q+1 ret.append((i,j)) i=j return ret def floor_sum(n,m,a,b): ans=0 while True: if a>=m: ans+=(n-1)*n*(a//m)//2 a%=m if b>=m: ans+=n*(b//m) b%=m y_max=(a*n+b)//m x_max=(y_max*m-b) if y_max==0: return ans ans+=(n-(x_max+a-1)//a)*y_max n,m,a,b=y_max,a,m,(a-x_max%a)%a def count(n,L,R,p): return floor_sum(R-L,n*n,p,L*p) M=3*10**5+10 moebius=[0]+[1]*M seive=[0]*2+[1]*M for p in range(2,M): if seive[p]: for i in range(p,M,p): seive[i]=0 moebius[i]*=-1 for i in range(p*p,M,p*p): moebius[i]=0 Mertens=[0]*M for i in range(1,M): Mertens[i]=Mertens[i-1]+moebius[i] def solve(): n,k=map(int,input().split()) QR=quotient_range(n) c=0 for L,R in QR: c+=count(n,L,R,n*n-1)*Mertens[n//L] if k==c+1: print('1/1') return if k<=c: rev=False elif k<=2*c+1: rev=True k=2*c+2-k else: print(-1) return ng,ok=-1,n*n while ok-ng>1: mid=(ok+ng)>>1 cnt=0 for L,R in QR: cnt+=count(n,L,R,mid)*Mertens[n//L] if cnt>=k: ok=mid else: ng=mid ng2,ok2=0,n while ok2-ng2>1: mid=(ok2+ng2)>>1 cnt1=floor_sum(mid,n*n,ok-1,ok-1) cnt2=floor_sum(mid,n*n,ok,ok) if cnt1!=cnt2: ok2=mid else: ng2=mid den=ok2 num=ok*den//(n*n) if rev: den,num=num,den print(str(num)+'/'+str(den)) for _ in range(int(input())): solve()