#include using namespace std; #define show(...) static_cast(0) #define all(c) begin(c), end(c) #define for(...) for ([[maybe_unused]] auto&& __VA_ARGS__) #define lambda(...) [&](auto&&... args) { return __VA_ARGS__; } #define $1 get<0>(tie(args...)) #define $2 get<1>(tie(args...)) template struct Rep { int l, r, d; Rep begin() const; int end() const; bool operator!=(int) const; void operator++(); int operator*() const; }; Rep<> rep(int, int, int = 1); Rep<> rep1(int, int, int = 1); Rep per(int, int, int = 1); Rep per1(int, int, int = 1); template int len(R&&); template int len(R&&, I); template bool chmin(T&, U&&); template bool chmax(T&, U&&); template ostream& operator<<(ostream&, const vector&); template auto operator<<(ostream& os, T&& t) -> decltype(tuple_cat(t), os); template T input(); template void print(Ts&&...); void solve() { int n = input(); auto k = input(); int i = 0; bool found = false; auto dfs = [&](auto self, int a1, int b1, int a2, int b2) -> void { int am = a1 + a2; int bm = b1 + b2; if (n < am || n < bm) { return; } show(am, bm); self(self, a1, b1, am, bm); ++i; if (i == k) { found = true; cout << am << '/' << bm << '\n'; return; } self(self, am, bm, a2, b2); }; dfs(dfs, 0, 1, 1, 0); if (!found) { print(-1); } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); for (_ : rep(0, input())) { solve(); } } template Rep Rep::begin() const { return *this; } template int Rep::end() const { return 0; } template bool Rep::operator!=(int) const { return l <= r; } template void Rep::operator++() { if constexpr (R) { r -= d; } else { l += d; } } template int Rep::operator*() const { if constexpr (R) { return r; } else { return l; } } inline Rep<> rep(int l, int r, int d) { assert(0 < d); return {l, r - 1, d}; } inline Rep<> rep1(int l, int r, int d) { assert(0 < d); return {l, r, d}; } inline Rep per(int l, int r, int d) { assert(0 < d); assert((r - l) % d == 0); return {l, r - d, d}; } inline Rep per1(int l, int r, int d) { assert(0 < d); return {l, r, d}; } template int len(R&& r) { return static_cast(size(forward(r))); } template int len(R&& r, I i) { return static_cast(distance(begin(forward(r)), i)); } template bool chmin(T& x, U&& y) { return y < x && (x = forward(y), true); } template bool chmax(T& x, U&& y) { return x < y && (x = forward(y), true); } template ostream& operator<<(ostream& os, const vector& v) { auto sep = ""; for (e : v) { os << exchange(sep, " ") << e; } return os; } template auto operator<<(ostream& os, T&& t) -> decltype(tuple_cat(t), os) { auto f = [&](auto&&... args) -> ostream& { [[maybe_unused]] auto sep = ""; (..., (os << exchange(sep, " ") << forward(args))); return os; }; return apply(f, forward(t)); } template T input() { T x; cin >> x; return x; } template void print(Ts&&... xs) { cout << forward_as_tuple(forward(xs)...) << '\n'; }