#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
struct Edge {
  int to, nxt;
} e[N << 1];
int n, x[N], head[N], ecnt, f[N], g[2][N];
void add(int bg, int ed) {
  e[++ecnt].nxt = head[bg];
  e[ecnt].to = ed;
  head[bg] = ecnt;
}
void dfs(int u) {
  for (int i = head[u]; i; i = e[i].nxt) dfs(e[i].to);
  memset(g[0], 0x3f, sizeof g[0]);
  int cur = 0;
  g[cur][0] = 0;
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    cur ^= 1;
    memset(g[cur], 0x3f, sizeof g[cur]);
    for (int j = 0; j <= x[u]; j++) {
      if (j - x[v] >= 0)
        g[cur][j] = min(g[cur ^ 1][j - x[v]] + f[v], g[cur][j]);
      if (j - f[v] >= 0)
        g[cur][j] = min(g[cur ^ 1][j - f[v]] + x[v], g[cur][j]);
    }
  }
  for (int i = 0; i <= x[u]; i++) f[u] = min(f[u], g[cur][i]);
}
int main() {
  scanf("%d", &n);
  for (int i = 2, p; i <= n; i++) scanf("%d", &p), add(p, i);
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  memset(f, 0x3f, sizeof f);
  dfs(1);
  if (f[1] < 0x3f3f3f3f)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
