#include<bits/stdc++.h>
#include<queue>
using namespace std;
void cha(int &a, int b) {
  if (b == -1) return;
  if (a == -1 || a > b) {
    a = b;
  }
}
int main () {
  int N;
  cin >> N;
  vector<vector<int>>son(N + 1, vector<int>(N + 1));
  vector<int>si(N + 1, 0);
  for (int i = 2; i <= N; i ++) {
    int a;
    cin >> a;
    son[a][si[a]] = i;
    si[a] ++;
  }
  vector<int>X(N + 1);
  for (int i = 1; i <= N; i ++) cin >> X[i];
  vector<int>per;
  queue<int>que;
  que.push(1);
  per.push_back(1);
  while(!que.empty()) {
    int u = que.front();
    for (int i = 0; i < si[u]; i ++) {
      int ne = son[u][i];
      per.push_back(ne);
      que.push(ne);
    }
    que.pop();
  }
  int dp[1010];
  for (int i = N - 1; i >= 0; i --) {
    int nw = per[i];
    if (!si[nw]) dp[nw] = 0;
    else {
      int *dp_ = new int[si[nw] + 1][5050];
      for (int i_ = 0; i_ >= si[nw]; i_ ++) {
        for (int j = 0; j < 5050; j ++) {
          dp_[i][j] = -1;
        }
      }
      dp_[0][0] = 0;
      for (int i_ = 1; i_ <= si[nw]; i_ ++) {
        int so = son[nw][i_];
        for (int j = X[nw]; j >= 0; j --) {
          if (j + X[so] <= X[nw] && dp_[i - 1][j] != -1) {
            cha(dp_[i][j + X[so]], dp_[i - 1][j] + dp[so]);
          }
          if (j + dp[so] <= X[nw] && dp_[i - 1][j] != -1) {
            cha(dp_[i][j + dp[so]], dp_[i - 1][j] + X[so]);
          }
        }
      }
      dp[nw] = -1;
      for (int i_ = 1; i_ <= X[nw]; i_ ++) {
        cha(dp[nw], dp_[si[nw]][i]);
      }
      if (dp[nw] == -1) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
      }
      delete[] dp_;
    }
  }
  cout << "POSSIBLE" << endl;
}
