from sys import stdin input=lambda :stdin.readline()[:-1] def calc(n,p): dp=[0]*(n+1) for i in range(1,n+1): s=(p*i)>>38 dp[i]+=s if dp[i]==0: continue for j in range(2*i,n+1,i): dp[j]-=dp[i] return sum(dp) m=1<<38 def solve(): n,k=map(int,input().split()) c=calc(n,m-1) 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=0,1<<38 for _ in range(38): mid=(ok+ng)>>1 if calc(n,mid)>=k: ok=mid else: ng=mid ans=-1 for p in range(1,n+1): q=(ok*p)>>38 if m*q>ng*p: if rev: p,q=q,p print(str(q)+'/'+str(p)) return raise Exception for _ in range(int(input())): solve()