from sys import stdin input=lambda :stdin.readline()[:-1] M=3*10**5+100 sieve=[0]*2+[1]*M primes=[] for p in range(2,M): if sieve[p]: primes.append(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)//(n*n) for p in primes: if p>n: return sum(dp) for i in range(n//p,0,-1): dp[i*p]-=dp[i] def solve(): n,k=map(int,input().split()) c=calc(n,n*n-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=-1,n*n while ok-ng>1: mid=(ok+ng)>>1 if calc(n,mid)>=k: ok=mid else: ng=mid for p in range(1,n+1): q=(ok*p)//(n*n) if n*n*q>ng*p: if rev: p,q=q,p print(str(q)+'/'+str(p)) return raise Exception for _ in range(int(input())): solve()