#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
long long mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
long long llmax = 9223372036854775807;
long long llmin = -9223372036854775807;
int iinf = intmax / 8;
long long inf = llmax / 8;
double eps = 1e-12;
struct edge {
  long long to, cost;
};
int V;
vector<edge> G[1000000];
long long d[1000000];
void addedge(int st, int ed, long long co) {
  edge e;
  e.to = ed;
  e.cost = co;
  G[st].push_back(e);
}
long long P[1010];
long long X[1010];
bool ok[1010];
long long val[1010];
long long dp[2][5010];
void dfs(long long v) {
  long long len = G[v].size();
  for (long long i = (long long)0; i < (long long)len; i++) {
    edge e = G[v][i];
    dfs(e.to);
  }
  if (len == 0) {
    val[v] = 0;
  } else {
    fill(dp[0], dp[0] + 5010, inf);
    edge e0 = G[v][0];
    dp[0][X[e0.to]] = val[e0.to];
    dp[0][val[e0.to]] = min(dp[0][val[e0.to]], X[e0.to]);
    for (long long i = (long long)1; i < (long long)len; i++) {
      fill(dp[1], dp[1] + 5010, inf);
      edge e = G[v][i];
      for (long long j = (long long)0; j < (long long)X[v] + 1; j++) {
        if (dp[0][j] == inf) {
          continue;
        }
        if (j + X[e.to] <= X[v]) {
          dp[1][j + X[e.to]] = min(dp[1][j + X[e.to]], dp[0][j] + val[e.to]);
        }
        if (j + val[e.to] <= X[v]) {
          dp[1][j + val[e.to]] = min(dp[1][j + val[e.to]], dp[0][j] + X[e.to]);
        }
      }
      swap(dp[0], dp[1]);
    }
    long long minval = inf;
    for (long long i = (long long)0; i < (long long)X[v] + 1; i++) {
      minval = min(minval, dp[0][i]);
    }
    if (minval == inf) {
      ok[v] = false;
      val[v] = inf;
    } else {
      val[v] = minval;
    }
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  P[0] = -1;
  for (long long i = (long long)1; i < (long long)N; i++) {
    cin >> P[i];
    addedge(P[i] - 1, i, 1);
  }
  for (long long i = (long long)0; i < (long long)N; i++) {
    cin >> X[i];
  }
  fill(ok, ok + N, true);
  dfs(0);
  bool allok = true;
  for (long long i = (long long)0; i < (long long)N; i++) {
    if (!ok[i]) {
      allok = false;
    }
  }
  if (allok) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}
