from sys import stdin input=lambda :stdin.readline()[:-1] M=3*10**5+5 sieve=[0]*2+[1]*M primes=[] for p in range(2,M): if sieve[p]: for i in range(2*p,M,p): sieve[i]=0 def calc(n,p): dp=[0]*(n+1) for i in range(1,n+1): dp[i]=(p*i)>>38 for p in range(n,1,-1): if sieve[p]: for i in range(n//p,0,-1): dp[i*p]-=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()