#include <bits/stdc++.h>
using namespace std;
int main() {
  int son[1001][1001];
  int N;
  cin >> N;
  vector<int> si(N, 0);
  vector<int> par(N);
  for (int i = 1; i < N; i++) {
    cin >> par[i];
    son[i][si[i]] = --par[i];
    si[i]++;
  }
  queue<int> tre;
  vector<bool> vis(N, false);
  vector<int> far(N, -1);
  far[0] = 0;
  tre.push(0);
  int fli[1010][1010];
  vector<int> fl_s(N, 0);
  fli[0][fl_s[0]] = 0;
  fl_s[0]++;
  int ma = 0;
  while (!tre.empty()) {
    int k = tre.front();
    for (int i = 0; i < si[k]; i++) {
      tre.push(son[k][i]);
      far[son[k][i]] = far[k] + 1;
      if (ma < far[k] + 1) ma = far[k] + 1;
      fli[far[k] + 1][fl_s[far[k] + 1]] = son[k][i];
      fl_s[far[k] + 1]++;
    }
    tre.pop();
  }
  vector<int> X(N);
  for (int i = 0; i < N; i++) cin >> X[i];
  int dp[1010];
  for (int i = 0; i < N; i++) {
    dp[i] = -1;
  }
  for (int i = ma; i >= 0; i--) {
    for (int j = 0; j < fl_s[i]; j++) {
      if (i == ma) {
        dp[i] = 0;
        continue;
      }
      int j_ = fli[i][j];
      vector<vector<int>> dp_(si[j_] + 1, vector<int>(5050, 1e9));
      dp_[0][0] = 0;
      for (int k = 0; k < si[j_]; k++) {
        for (int l = 0; l <= X[j_]; l++) {
          int al = son[j_][k];
          if (l + X[al] <= X[j_]) {
            if (dp_[k + 1][l + X[al]] > dp_[k][l] + dp[al]) {
              dp_[k + 1][l + X[al]] = dp_[k][l] + dp[al];
            }
          }
          if (l + dp[al] <= X[j_]) {
            if (dp_[k + 1][l + dp[al]] > dp_[k][l] + X[al]) {
              dp_[k + 1][l + dp[al]] = dp_[k][l] + X[al];
            }
          }
        }
      }
      for (int k = 0; k <= X[j_]; k++) {
        if (dp_[si[j_]][k] == 1e9) continue;
        if (dp[j_] == -1 || dp_[si[j_]][k] < dp[j_]) {
          dp[j_] = dp_[si[j_]][k];
        }
      }
      if (dp[j_] == -1) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
      }
    }
  }
  cout << "POSSIBLE" << endl;
}
