#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
vector<vector<long long>> childs;
long long N;
vector<long long> X;
vector<long long> DP;
int main() {
  cin >> N;
  childs.resize(N);
  X.resize(N);
  for (long long n = 1; n < N; n++) {
    long long p;
    cin >> p;
    p--;
    childs[p].push_back(n);
  }
  for (long long n = 0; n < N; n++) cin >> X[n];
  DP.resize(N);
  for (long long n = N - 1; n >= 0; n--) {
    if (childs[n].size() == 0) {
      DP[n] = 0;
      continue;
    }
    long long sum = 0;
    vector<long long> DP2(5000 + 1, false);
    DP2[0] = true;
    for (long long child : childs[n]) {
      for (long long w = 5000; w >= 0; w--) {
        DP2[w] = false;
        if (w >= DP[child]) DP2[w] |= DP2[w - DP[child]];
        if (w >= X[child]) DP2[w] |= DP2[w - X[child]];
      }
      sum += X[child] + DP[child];
    }
    long long w = X[n];
    bool flag = false;
    for (; w >= 0; w--) {
      if (DP2[w]) {
        DP[n] = sum - w;
        flag = true;
        break;
      }
    }
    if (!flag) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
