#include using namespace std; using ll = long long; int main () { int T; cin >> T; vector> X(300030); for (int i = 1; i <= 300000; i ++) { for (int j = 1; i * j <= 300000; j ++) { X[i * j].push_back(i); } } int meb[300030]; fill(meb, meb + 300030, -2); meb[1] = 1; for (int i = 2; i <= 300000; i ++) { if (meb[i] == -2) { meb[i] = -1; } for (int j = 2; i * j <= 300000; j ++) { meb[i * j] *= -1; if (j % i == 0) { meb[i * j] = 0; } } } while (T --) { ll N, K; cin >> N >> K; if (N == 1) { puts("1/1"); continue; } double l = 0, r = N + 1; bool ok = false; while(true) { double mu = (l + r) / 2; ll sum = 0; for (ll m = 1; m <= N; m ++) { ll n = min(N, (ll)(mu * m)); for (auto a : X[m]) { sum += (n / a) * meb[a]; } } if (sum <= K) { l = mu; } else { r = mu; } if (sum == K) { ok = true; break; } if (l > N) { break; } } if (ok) { ll s = 0, b = 1; for (ll m = 1; m <= N; m ++) { ll a = (ll)(m * l); a = min(a, N); if (b * a >= m * s) { s = a; b = m; } } printf("%lld/%lld\n", s, b); } else { puts("-1"); } } }