#include <bits/stdc++.h>
using namespace std;
int x[1000];
vector<int> E[1000];
int dp[2000][6000], memo[2000];
void dfs(int v) {
  if (E[v].empty()) {
    memo[v] = 0;
    return;
  }
  for (auto u : E[v]) {
    dfs(u);
  }
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 0; i < (E[v].size()); i++)
    for (int j = 0; j < (x[v] + 1); j++) {
      if (j + x[E[v][i]] <= x[v])
        dp[i + 1][j + x[E[v][i]]] =
            min(dp[i + 1][j + x[E[v][i]]], dp[i][j] + memo[E[v][i]]);
      if (j + memo[E[v][i]] <= x[v])
        dp[i + 1][j + memo[E[v][i]]] =
            min(dp[i + 1][j + memo[E[v][i]]], dp[i][j] + x[E[v][i]]);
    }
  memo[v] = 0x3f3f3f3f;
  for (int i = 0; i < (x[v] + 1); i++) {
    memo[v] = min(memo[v], dp[E[v].size()][i]);
  }
  if (memo[v] == 0x3f3f3f3f) {
    puts("IMPOSSIBLE");
    exit(0);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < (n - 1); i++) {
    int p;
    scanf("%d", &p);
    p--;
    E[p].push_back(i + 1);
  }
  for (int i = 0; i < (n); i++) scanf("%d", &x[i]);
  dfs(0);
  puts("POSSIBLE");
}
