#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> P, X;
vector<vector<int>> Q;
vector<pair<int, int>> a;
bool flag;
void dfs(int s) {
  if (!flag) return;
  if (Q[s].empty()) {
    a[s] = make_pair(X[s], 0);
    return;
  }
  vector<pair<int, int>> b;
  for (int t : Q[s]) {
    dfs(t);
    if (!flag) return;
    b.push_back(a[t]);
  }
  int M = b.size();
  vector<bool> dp(X[s] + 1, false);
  if (b[0].first <= X[s]) dp[b[0].first] = true;
  if (b[0].second <= X[s]) dp[b[0].second] = true;
  for (int i = 1; i < M; i++) {
    int x = b[i].first;
    int y = b[i].second;
    for (int j = X[s]; j >= 0; j--) {
      if (j - x >= 0 && dp[j - x]) dp[j] = true;
      if (j - y >= 0 && dp[j - y]) dp[j] = true;
    }
  }
  int opt = -1;
  for (int i = X[s]; i >= 0; i--) {
    if (dp[i]) {
      opt = i;
      break;
    }
  }
  if (opt == -1) {
    flag = false;
    return;
  }
  int sm = 0;
  for (int i = 0; i < M; i++) {
    sm += b[i].first;
    sm += b[i].second;
  }
  int Y = sm - opt;
  a[s] = make_pair(X[s], Y);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  flag = true;
  cin >> N;
  P.resize(N);
  X.resize(N);
  Q.resize(N);
  a.resize(N);
  for (int i = 1; i < N; i++) cin >> P[i];
  for (int i = 1; i < N; i++) P[i]--;
  for (int i = 0; i < N; i++) cin >> X[i];
  for (int i = 1; i < N; i++) Q[P[i]].push_back(i);
  dfs(0);
  if (flag)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
