#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 5;
const int maxW = 5000 + 5;
const int inf = 0x3f3f3f3f;
vector<int> ed[maxn];
void addedge(int from, int to) {
  ed[from].push_back(to);
  ed[to].push_back(from);
}
int n;
int X[maxn], f[maxn][2], g[maxn][maxW];
void dfs(int v, int fa) {
  f[v][0] = f[v][1] = inf;
  for (int i = 0; i < (int)ed[v].size(); i++) {
    int u = ed[v][i];
    if (u != fa) dfs(u, v);
  }
  memset(g, inf, sizeof(g));
  for (int i = 0; i <= 1; i++) {
    g[0][0] = 0;
    int cnt = 0;
    for (int j = 1; j <= X[v]; j++) g[0][j] = inf;
    for (int j = 0; j < (int)ed[v].size(); j++) {
      int u = ed[v][j];
      if (u == fa) continue;
      cnt++;
      for (int w = 0; w <= X[v]; w++) g[cnt][w] = inf;
      for (int w = 0; w <= X[v]; w++) {
        if (w + X[u] <= X[v])
          g[cnt][w + X[u]] = min(g[cnt - 1][w] + f[u][i ^ 1], g[cnt][w + X[u]]);
        if (w + f[u][i ^ 1] <= X[v])
          g[cnt][w + f[u][i ^ 1]] =
              min(g[cnt][w + f[u][i ^ 1]], g[cnt - 1][w] + X[u]);
      }
    }
    for (int w = 0; w <= X[v]; w++) f[v][i] = min(f[v][i], g[cnt][w]);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int p;
    scanf("%d", &p);
    addedge(i, p);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &X[i]);
  dfs(1, -1);
  if (f[1][0] < inf || f[1][1] < inf)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
