#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
vector<long long> tree[1010];
long long dp[1010] = {};
long long X[1010];
void dfs(long long cur, long long par) {
  vector<long long> nxt(X[cur] + 1, INF);
  nxt[0] = 0;
  for (auto &e : tree[cur]) {
    if (e == par) continue;
    dfs(e, cur);
    vector<long long> prv = move(nxt);
    fill(nxt.begin(), nxt.end(), INF);
    for (long long v = (0); v < (X[cur] + 1); v++) {
      if (v + dp[e] <= X[cur] && prv[v] < INF) {
        nxt[v + dp[e]] = min(nxt[v + dp[e]], prv[v] + X[e]);
      }
      if (v + X[e] <= X[cur] && prv[v] < INF) {
        nxt[v + X[e]] = min(nxt[v + X[e]], prv[v] + dp[e]);
      }
    }
  }
  long long res = INF;
  for (long long i = (0); i < (X[cur] + 1); i++) res = min(res, nxt[i]);
  dp[cur] = res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  if (N > 10) return 0;
  long long P[1010];
  for (long long i = (0); i < (N - 1); i++) {
    cin >> P[i];
    P[i]--;
    tree[P[i]].push_back(i + 1);
  }
  for (long long i = (0); i < (N); i++) cin >> X[i];
  for (long long i = (0); i < (N); i++) dp[i] = INF;
  dfs(0, -1);
  if (dp[0] != INF) {
    cout << ("POSSIBLE") << endl;
    ;
  } else {
    cout << ("IMPOSSIBLE") << endl;
    ;
  }
}
