#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const int INF = 1e9;
int h[maxn], mem;
struct {
  int v, next;
} e[maxn];
void add(int u, int v) {
  e[mem].v = v;
  e[mem].next = h[u];
  h[u] = mem++;
}
int p[maxn];
bool flag;
int dp[maxn][maxn * 5];
int ans[maxn];
void dfs(int u) {
  if (flag) return;
  if (h[u] == -1) {
    ans[u] = 0;
    return;
  }
  dp[u][0] = 0;
  for (int i = h[u]; i + 1; i = e[i].next) {
    int v = e[i].v;
    dfs(v);
    for (int j = p[u]; j >= 0; j--) {
      if (ans[v] == 0) {
        dp[u][j] = dp[u][j] + p[v];
      } else {
        dp[u][j] = INF;
        if (j >= ans[v]) dp[u][j] = dp[u][j - ans[v]] + p[v];
      }
      if (j >= p[v]) {
        dp[u][j] = min(dp[u][j], dp[u][j - p[v]] + ans[v]);
      }
    }
  }
  ans[u] = INF;
  for (int i = 0; i <= p[u]; i++) {
    ans[u] = min(ans[u], dp[u][i]);
  }
  if (ans[u] >= 1e7) {
    flag = 1;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  memset(h, -1, sizeof(h));
  mem = 0;
  memset(dp, 17, sizeof(dp));
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    add(x, i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", p + i);
  }
  flag = 0;
  dfs(1);
  printf("%s\n", flag ? "IMPOSSIBLE" : "POSSIBLE");
  return 0;
}
