#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9+7;

vector<int> g[1005];
int dp[1005], x[1005];

void dfs(int v, int p = -1) {
    vector<int> cur(x[v] + 1, INF);
    cur[0] = 0;
    for (int u : g[v]) {
      if (u == p) continue;
      dfs(u,v);
      vector<int> prev = move(cur);
      cur.assign(x[v]+1, INF);
      rep(w, prev.size()) {
        if (prev[w] < INF) {
          if (w + x[u] <= x[v]) chmin(cur[w + x[u]], prev[w] + dp[u]);
          if (w + dp[u] <= x[v]) chmin(cur[w + dp[u]], prev[w] + x[u]);
        }
      }
    }
    dp[v] = *min_element(cur.begin(), cur.end());
}

int main() {
  int n;
  cin >> n;
  rep(i,n-1) {
    int p;
    cin >> p;
    --p;
    g[p].push_back(i+1);
  }
  rep(i,n) cin >> x[i];

  dfs(0);
  bool res = dp[0] < INF;
  if (dp[0] < INF) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}