#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1e18;
using pii = pair<int, int>;
using graph = vector<vector<int>>;
bool rec(int v, graph const& g, vector<set<int>>& dp, vector<int> const& X) {
  if (g[v].size() == 0) {
    dp[v].insert(0);
    return true;
  }
  set<pii> dp2;
  dp2.insert(make_pair(0, 0));
  for (int i = 0; i < g[v].size(); ++i) {
    set<pii> nxt;
    int ch = g[v][i];
    if (!rec(ch, g, dp, X)) {
      return false;
    }
    for (auto p : dp2) {
      for (auto y : dp[ch]) {
        if (p.first + y <= X[v]) {
          nxt.insert(make_pair(p.first + y, p.second + X[v]));
        }
        if (p.first + X[ch] <= X[v]) {
          nxt.insert(make_pair(p.first + X[ch], p.second + y));
        }
      }
    }
    dp2 = move(nxt);
  }
  for (auto p : dp2) {
    dp[v].insert(p.second);
  }
  return !dp[v].empty();
}
int main() {
  int N;
  cin >> N;
  vector<vector<int>> g(N);
  for (int i = 0; i < N - 1; ++i) {
    int p;
    cin >> p;
    g[p - 1].push_back(i + 1);
  }
  vector<int> X(N);
  for (int i = 0; i < N; ++i) {
    cin >> X[i];
  }
  vector<set<int>> dp(N);
  if (rec(0, g, dp, X)) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}
