#include <bits/stdc++.h>
using namespace std;
const long long INF = (1ll << 62);
int main() {
  long long N;
  cin >> N;
  vector<long long> P(N);
  P[0] = 0;
  for (long long i = 1; i < N; i++) {
    cin >> P[i];
    P[i] -= 1;
  }
  vector<long long> X(N);
  for (long long i = 0; i < N; i++) cin >> X[i];
  vector<vector<long long>> C(N);
  for (long long i = 1; i < N; i++) C[P[i]].push_back(i);
  vector<long long> order;
  queue<long long> q;
  q.push(0);
  order.push_back(0);
  while (q.size()) {
    for (long long i : C[q.front()]) {
      q.push(i);
      order.push_back(i);
    }
    q.pop();
  }
  reverse(order.begin(), order.end());
  vector<long long> sum(N);
  for (long long i : order) {
    if (C[i].size() == 0) {
      sum[i] = X[i];
    } else {
      sum[i] = X[i];
      for (long long j : C[i]) sum[i] += sum[j];
    }
  }
  vector<long long> dp(N);
  for (long long v : order) {
    if (C[v].size() == 0) continue;
    vector<vector<long long>> dp2(C[v].size(), vector<long long>(5001, INF));
    dp2[0][X[C[v][0]]] = dp[C[v][0]];
    dp2[0][dp[C[v][0]]] = X[C[v][0]];
    for (long long i = 1; i < C[v].size(); i++)
      for (long long j = 0; j < 5001; j++) {
        long long c = C[v][i];
        if (j >= X[c]) dp2[i][j] = min(dp2[i][j], dp2[i - 1][j - X[c]] + dp[c]);
        if (j >= dp[c])
          dp2[i][j] = min(dp2[i][j], dp2[i - 1][j - dp[c]] + X[c]);
      }
    long long mi = INF;
    for (long long j = 0; j < X[v] + 1; j++)
      if (dp2[C[v].size() - 1][j] < INF) {
        mi = min(mi, dp2[C[v].size() - 1][j]);
      }
    if (mi == INF) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
    dp[v] = mi;
  }
  cout << "POSSIBLE" << endl;
}
