#include #include #define N_MAX 100000 inline int I() { register int c = getchar(), x = 0; for (;!isdigit(c); c = getchar()); for (; isdigit(c); c = getchar()) x = x * 10 - '0' + c; return x; } int T, n, i, x, a[N_MAX], d[N_MAX], f[N_MAX]; int main() { for (T = I(); T; --T) { n = I(); for (i = 1; i < n; ++i) d[i] = d[f[i] = I()] ^ 1; for (i = 0; i < n; ++i) a[i] = I(); x = 0; for (i = 0; i < n; ++i) if (d[i]) x ^= a[i]; puts(x ? "win" : "lose"); } return 0; }