#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
struct Edge {
  int v, nxt;
} edge[1005 << 1];
int n, cnt, head[1005], val[1005], f[1005][2], dp[2][5005];
inline void add_edge(int x, int y) {
  edge[++cnt].v = y;
  edge[cnt].nxt = head[x];
  head[x] = cnt;
}
void dfs(int x, int fa) {
  int flag = 0;
  for (int i = head[x]; i; i = edge[i].nxt) {
    if (edge[i].v == fa) continue;
    flag = 1;
    dfs(edge[i].v, x);
  }
  if (!flag) {
    f[x][0] = f[x][1] = 1;
    return;
  }
  memset(dp, 0, sizeof(dp));
  for (int i = head[x]; i; i = edge[i].nxt) {
    int y = edge[i].v;
    if (y == fa) continue;
    for (int j = val[x]; j >= 0; j--) {
      if (j - val[y] < 0) continue;
      if (f[y][0]) dp[0][j] = max(dp[0][j], dp[0][j - val[y]] + val[y]);
      if (f[y][1]) dp[1][j] = max(dp[1][j], dp[1][j - val[y]] + val[y]);
    }
  }
  if (dp[0][val[x]]) f[x][0] = 1;
  if (dp[1][val[x]]) f[x][1] = 1;
}
int main() {
  n = read();
  for (int i = 2; i <= n; i++) {
    int a = read();
    add_edge(i, a);
    add_edge(a, i);
  }
  for (int i = 1; i <= n; i++) val[i] = read();
  dfs(1, -1);
  if (f[1][0] || f[1][1])
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
