#include #include using namespace atcoder; using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define rrep(i,a,b) for(int i = a; i >= b; i--) #define fore(i,a) for(auto& i : a) #define sz(x) (int)(x).size() #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define pcnt __builtin_popcount #define loop while(true) using ll = long long; using pint = pair; using pll = pair; using NGraph = vector>; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; const int IINF = 1000100100; const long long LINF = 1LL << 60; template int former(const vector &v, T x) { return upper_bound(v.begin(), v.end(), x) - v.begin() - 1; } template int latter(const vector &v, T x) { return lower_bound(v.begin(), v.end(), x) - v.begin(); } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } int get_grundy_s(int x, vector& grundy, int N, int K) { if (grundy[x] != -1) return grundy[x]; set se; for (int i = x+1; i <= min(x+K, N-1); ++i) { se.insert(get_grundy_s(i, grundy, N, K)); } int subgame = 0; while (se.count(subgame)) subgame++; return grundy[x] = subgame; } bool get_grundy_v(int x, vector& grundy, int N, int K) { if (grundy[x] != -1) return grundy[x]; vector ve(N, false); for (int i = x+1; i <= min(x+K, N-1); ++i) { ve[get_grundy_v(i, grundy, N, K)] = true; } int subgame = 0; while (ve[subgame]) subgame++; return grundy[x] = subgame; } int main() { int p; cin >> p; for (int i = 0; i < p; ++i) { int n, k; cin >> n >> k; vector grundy(n, -1); int result = get_grundy_v(0, grundy, n, k); if (result) cout << "Win" << endl; else cout << "Lose" << endl; } return 0; }