1 #include<stdio.h> 2 #include<string.h> 3 #include<set> 4 using namespace std; 5 6 int sg[205][205]; 7 8 int solve(int w,int h){ 9 if(sg[w][h]!=-1){ 10 return sg[w][h]; 11 } 12 set<int> my_set; 13 for(int i=2;w-i>=2;i++){ 14 my_set.insert(solve(i,h)^solve(w-i,h)); 15 } 16 for(int j=2;h-j>=2;j++){ 17 my_set.insert(solve(w,j)^solve(w,h-j)); 18 } 19 int g=0; 20 while(my_set.count(g)){ 21 g++; 22 } 23 return sg[w][h]=g; 24 } 25 26 int main(){ 27 int w,h; 28 memset(sg,-1,sizeof(sg)); 29 while(~scanf("%d%d",&w,&h)){ 30 if(solve(w,h)){ 31 puts("WIN"); 32 } 33 else{ 34 puts("LOSE"); 35 } 36 } 37 }