#include #include int cmp_fr (const void *a, const void *b) { long long *a_ = (long long *)a; long long *b_ = (long long *)b; if (a_[0]*b_[1] < a_[1]*b_[0]) { return -1; } if (a_[0]*b_[1] > a_[1]*b_[0]) { return 1; } return 0; } int main () { int t = 0; int res = 0; long long ps[300001][10] = {}; int pcnt[300001] = {}; long long fr[300000][2] = {}; for (int i = 2; i <= 300000; i++) { if (pcnt[i] <= 0) { ps[i][0] = (long long)i; pcnt[i] = 1; for (int p = 2; i*p <= 300000; p++) { ps[i*p][pcnt[i*p]] = i; pcnt[i*p]++; } } } res = scanf("%d", &t); while (t > 0) { long long n = 0LL; long long k = 0LL; long long rcnt = 1LL; res = scanf("%lld", &n); res = scanf("%lld", &k); rcnt = n*n; for (long long i = 1LL; i <= n; i += 1LL) { for (int j = 1; j < (1< 0) { p *= ps[(int)i][l]; bcnt++; } } if (bcnt%2 == 1) { rcnt -= n/p; } else { rcnt += n/p; } } } if (rcnt < k) { printf("-1\n"); } else { long long ans[2] = {}; long long l = 0LL; long long r = (1LL<<19LL); long long div = 1LL; long long lcnt = 0LL; int frcnt = 0; int ucnt = 1; while (div <= n) { long long nxt = l+r; long long cnt = 0LL; if (nxt%2LL == 1LL) { div *= 2LL; l *= 2LL; r *= 2LL; } else { nxt /= 2LL; } for (long long i = 1LL; i <= n; i += 1LL) { long long d = (nxt*i)/div; long long diff = 0LL; if (d > n) { d = n; } for (int j = 1; j < (1< 0) { p *= ps[(int)i][l]; bcnt++; } } if (bcnt%2 == 1) { diff += d/p; } else { diff -= d/p; } } cnt += d-diff; } if (cnt < k) { l = nxt; lcnt = cnt; } else { r = nxt; rcnt = cnt; } } for (long long i = 1LL; i <= n; i += 1LL) { long long d = (r*i)/div; if (d <= n && l*i < d*div) { fr[frcnt][0] = d; fr[frcnt][1] = i; frcnt++; } } qsort(fr, frcnt, sizeof(long long)*2, cmp_fr); for (int i = 1; i < frcnt; i++) { if (fr[ucnt-1][0]*fr[i][1] != fr[ucnt-1][1]*fr[i][0]) { fr[ucnt][0] = fr[i][0]; fr[ucnt][1] = fr[i][1]; ucnt++; } else if (fr[ucnt-1][0]%fr[i][0] == 0LL) { fr[ucnt-1][0] = fr[i][0]; fr[ucnt-1][1] = fr[i][1]; } } printf("%lld/%lld\n", fr[(int)(k-lcnt-1LL)][0], fr[(int)(k-lcnt-1LL)][1]); } t--; } return 0; }