#include using namespace std; typedef long long ll; #define sz(X) ((int)X.size()) const int N = 1e5+5; const ll INF = 1e18; int a[N]; struct Node{ int to, nx; }E[N *2]; int head[N], tot; void add(int u, int v) { E[tot].to = v; E[tot].nx = head[u]; head[u] = tot++; } int dep[N]; void dfs(int x, int pre) { dep[x] = dep[pre]+1; for(int i = head[x]; ~i; i = E[i].nx) { int y = E[i].to; dfs(y, x); } } int main() { int n; int _; scanf("%d",&_); while(_--) { memset(head,-1,sizeof(head)); tot = 0; scanf("%d",&n); for(int i = 1; i < n; ++i) { int a; scanf("%d",&a); add(a, i); } dep[0] = 0; for(int i = 0; i < n; ++i) scanf("%d",&a[i]); dfs(0,0); int all = 0; for(int i = 1; i < n; ++i) { if(dep[i] % 2 == 0) all ^= a[i]; } if(all) printf("win\n"); else printf("lose\n"); } return 0; }