#include #pragma comment(linker, "/STACK:102400000,102400000") #define LL long long #define pii pair #define xx first #define yy second using namespace std; const int N = 510000; vector g[N]; int a[N], r; void dfs (int u, int x) { if (x) r ^= a[u]; for (int i = 0; i < g[u].size(); i++) { dfs (g[u][i], x ^ 1); } } int main () { // freopen ("in.txt", "r", stdin); int T; cin >> T; while (T--) { int n, x; cin >> n; for (int i = 0; i < n; i++) g[i].clear(); for (int i = 1; i < n; i++) { scanf("%d", &x); g[x].push_back (i); } for (int i = 0; i < n; i++) scanf ("%d", &a[i]); r = 0; dfs (0, 0); printf (r ? "win\n" : "lose\n"); } }