#include #include #include #include #include constexpr int UNDEF = -1; // Based on http://solorab.net/blog/2015/12/19/srm-676-med/ int mex(std::set const& s) { int m = 0; for (auto x : s) { if (x == m) { m++; } else { break; } } return m; } int compute_grundy_number(int n, int k) { std::vector gs; gs = std::vector(n, UNDEF); gs[n - 1] = 0; for (auto i = n - 2; i >= 0; i--) { std::set next_gs; for (auto j = i + 1; j <= std::min(n - 1, i + k); j++) { next_gs.insert(gs[j]); } gs[i] = mex(next_gs); } return gs[0]; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int p; std::cin >> p; for (auto i = 0; i < p; i++) { int n, k; std::cin >> n >> k; int g; g = compute_grundy_number(n, k); std::cout << (g != 0 ? "Win" : "Lose") << std::endl; } return EXIT_SUCCESS; }