#include #include #include #include int game(int const n, int const k){ if( n-1 <= k ){ return 1; //win } std::map wl; wl[n-1] = true; for( int i = 2; i <= n; ++i ){ int const m = std::min(k, i); wl[n-i]=true; // std::cout << "i:"<< i << std::endl; for( int j = 1; j <= m; ++j) { // std::cout << "****j:" << j << std::endl; if(wl[n-i+j]==true){ wl[n - i] = false; break; } } } /*std::cout << "**********" << std::endl; for(int i = 0; i < n; ++i ) { std::cout << i << ": " << wl[i] << std::endl; } std::cout << "**********" << std::endl; */ //1-k縺ョ髢薙〒縺ゥ繧後°�シ代▽縺ァ繧ょ享縺。遲九′縺ゅk縺九←縺�縺九�ョ繝√ぉ繝�繧ッ for(int i = 1; i <= k; ++i) { if(wl[i]==true) return 1; } return 0; } int main() { std::vector< int > result; int p = 0; std::cin >> p; for( int i = 0; i < p; ++i ) { int n = 0, k = 0; std::cin >> n >> k; result.push_back(game(n, k)); } for(auto const i: result) { if( i == 1 ) std::cout << "Win" << std::endl; else std::cout << "Lose" << std::endl; } }