/****************************>>>>HEADFILES<<<<****************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /****************************>>>>>DEFINE<<<<<*****************************/ #define fst first #define snd second #define root 1, N, 1 #define lson l, mid, (rt << 1) #define rson mid + 1, r, (rt << 1 | 1) #define __mid__ int mid = (l + r) >> 1 #define PB(a) push_back(a) #define MP(a,b) make_pair(a,b) #define FIN freopen("input.txt","r",stdin) #define FOUT freopen("output.txt","w",stdout) //#pragma comment(linker, "/STACK:1024000000,1024000000") typedef __int64 LL; const int INF = 0x3f3f3f3f; const int MAXN = 100000 + 5; /****************************>>>>SEPARATOR<<<<****************************/ int n, fa[MAXN], a[MAXN]; int dep[MAXN]; struct Edge { int v, next; } edge[MAXN]; int head[MAXN], tot; void init_edge() { tot = 0; memset(head, -1, sizeof(head)); } void add_edge(int u, int v) { edge[tot] = Edge{v, head[u]}; head[u] = tot ++; } void dfs(int u, int k) { int v; dep[u] = k; for(int i = head[u]; ~i; i = edge[i].next) { v = edge[i].v; dfs(v, k + 1); } } int main() { #ifndef ONLINE_JUDGE FIN; #endif // ONLINE_JUDGE int _; scanf("%d", &_); while(_--) { init_edge(); scanf("%d", &n); for(int i = 1; i < n; i ++) { scanf("%d", &fa[i]); add_edge(fa[i], i); } for(int i = 0; i < n; i ++) { scanf("%d", &a[i]); } dfs(0, 1); LL ans = 0; for(int i = 0; i < n; i ++) { if(dep[i] & 1) continue; ans ^= (LL)a[i]; } printf("%s\n", ans ? "win" : "lose"); } return 0; }