#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int INF = 1000000010;
const long long int LINF = 4000000000000000010LL;
const int MAX = 310;
const double EPS = 1e-9;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
vector<int> G[1010];
int x[1010];
int dfs(int now, int p) {
  int dp[2][5010];
  for (int i = 0; i <= x[now]; i++) {
    dp[0][i] = INF;
    dp[1][i] = INF;
  }
  int cu = 1;
  int to = 0;
  dp[cu][0] = 0;
  for (auto e : G[now]) {
    if (e == p) continue;
    int w = dfs(e, now);
    int b = x[e];
    for (int i = 0; i <= x[now]; i++) {
      if (dp[cu][i] != INF) {
        if (i + w <= x[now]) {
          dp[to][i + w] = min(dp[to][i + w], dp[cu][i] + b);
        }
        if (i + b <= x[now]) {
          dp[to][i + b] = min(dp[to][i + b], dp[cu][i] + w);
        }
        cu = (cu + 1) % 2;
        to = (to + 1) % 2;
      }
    }
    int res = INF;
    for (int i = 0; i <= x[now]; i++) {
      res = min(res, dp[cu][i]);
    }
    return res;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    G[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  if (dfs(0, -1) == INF) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << "POSSIBLE" << endl;
  }
  return 0;
}
