#include #include int test(int m,int n) { if (m==0 && n==0) return 0; if (m>0 && n>0 && !test(m-1,n-1)) return 1; if (m>0 && !test(m-1,n)) return 1; if (n>0 && !test(m,n-1)) return 1; return 0; } main() { int m,n; scanf("%d %d",&m,&n); while (m && n) { if (!test(m-1,n-1)) printf("Win by taking from both\n"); else if (!test(m-1,n)) printf("Win by taking from first\n"); else if (!test(m,n-1)) printf("Win by taking from second\n"); else printf("Can't win\n"); scanf("%d %d",&m,&n); } }