#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; } ll lb = 1, ls = 0, rb = 0, rs = 1; bool ok = false; while(true) { ll b = lb + rb, s = ls + rs; if (b > N || s > N) { break; } ll sum = 0; for (ll m = 1; m <= N; m ++) { ll n = min(N, (m * s) / b); for (auto a : X[m]) { sum += (n / a) * meb[a]; } } if (sum <= K) { lb = b; ls = s; } else { rb = b; rs = s; } if (sum == K) { ok = true; break; } } if (ok) { printf("%lld/%lld\n", ls, lb); } else { puts("-1"); } } }