#include <bits/stdc++.h>
using namespace std;
long long n;
vector<long long> g[1010];
long long x[1010];
bool dp[2][5050];
pair<long long, long long> dfs(long long v, long long pre) {
  vector<pair<long long, long long> > a;
  long long sum = 0;
  for (long long nv : g[v]) {
    if (nv == pre) continue;
    pair<long long, long long> tmp = dfs(nv, v);
    a.push_back(tmp);
    sum += tmp.first + tmp.second;
  }
  long long m = a.size();
  memset(dp, 0, sizeof(dp));
  long long crt = 0, nxt = 1;
  dp[crt][0] = true;
  for (long long i = (long long)(0); i < (long long)(m); i++) {
    memset(dp[nxt], 0, sizeof(dp[nxt]));
    for (long long j = 5000; j >= 0; j--) {
      if ((j - a[i].first >= 0 && dp[crt][j - a[i].first]) ||
          (j - a[i].second >= 0 && dp[crt][j - a[i].second]))
        dp[nxt][j] = true;
    }
    swap(crt, nxt);
  }
  long long res = 1e16;
  for (long long j = (long long)(0); j < (long long)(5001); j++) {
    if (j <= x[v] && dp[crt][j]) res = (res < sum - j ? res : sum - j);
  }
  if (res == 1e16) return pair<long long, long long>(-1, -1);
  return pair<long long, long long>(res, x[v]);
}
int main() {
  cin.sync_with_stdio(false);
  cin >> n;
  for (long long i = (long long)(1); i < (long long)(n); i++) {
    long long p;
    cin >> p;
    p--;
    g[p].push_back(i);
    g[i].push_back(p);
  }
  for (long long i = (long long)(0); i < (long long)(n); i++) cin >> x[i];
  pair<long long, long long> res = dfs(0, -1);
  if (res == pair<long long, long long>(-1, -1))
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
  return 0;
}
