#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e3 + 5;
vector<int> v1[MAXN];
int X[MAXN];
int dp[MAXN];
int tmpdp[MAXN][MAXN];
void dfs(int curr, int par) {
  for (int x : v1[curr]) {
    if (x != par) {
      dfs(x, curr);
    }
  }
  for (int i = 1; i <= 5000; i++) {
    tmpdp[0][i] = 1e9;
  }
  for (int i = 1; i <= v1[curr].size(); i++) {
    int child = v1[curr][i - 1];
    for (int j = 0; j <= 5000; j++) {
      tmpdp[i][j] = 1e9;
      if (j >= X[child]) {
        tmpdp[i][j] = min(tmpdp[i][j], tmpdp[i - 1][j - X[child]] + dp[child]);
      }
      if (j >= dp[child]) {
        tmpdp[i][j] = min(tmpdp[i][j], tmpdp[i - 1][j - dp[child]] + X[child]);
      }
    }
  }
  dp[curr] = 1e9;
  for (int i = 0; i <= X[curr]; i++) {
    dp[curr] = min(dp[curr], tmpdp[v1[curr].size()][i]);
  }
  if (v1[curr].size() == 0) {
    dp[curr] = 0;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    v1[p].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> X[i];
  }
  dfs(1, 1);
  for (int i = 1; i <= n; i++) {
    if (dp[i] > 5000) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
  }
  cout << "POSSIBLE" << endl;
}
