import sys input = sys.stdin.readline M = 3*10**5 prime = [True] * (M+1) totient = list(range(M+1)) for i in range(2, M+1): if prime[i]: for j in range(i, M+1, i): if j != i: prime[j] = False totient[j] = totient[j]//i*(i-1) def solve(N, K): total = 0 for n in range(1, N+1): total += totient[n] if K >= 2*total: print(-1) return flip = False if K > total: K = 2*total-K flip = True D = 10**12 lb, ub = 0, D+1 while ub-lb > 1: m = (lb+ub)//2 cnt = 0 g = [0]*(N+1) for i in range(1, N+1): g[i] = i*m//D for p in range(2, N+1): if not prime[p]: continue for k in range(1, N//p+1)[::-1]: g[k*p] -= g[k] if sum(g) < K: lb = m else: ub = m for d in range(1, N+1): if (d*lb+D-1)//D <= d*ub//D: n = d*ub//D if flip: d, n = n, d print(f"{n}/{d}") return T = int(input()) for _ in range(T): N, K = map(int, input().split()) solve(N, K)