#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge {
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<int>>;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
void dfs(Graph &G, vector<vector<ll>> &dp, vector<int> &X, int v, int p) {
  int white = 0, black = 0;
  vector<int> any;
  for (auto u : G[v]) {
    if (u == p) continue;
    dfs(G, dp, X, u, v);
    if (dp[u][0] == INF && dp[u][1] == INF) {
      return;
    }
    if (dp[u][0] == INF) {
      white = dp[u][1];
      black = X[u];
    } else if (dp[u][1] == INF) {
      white = X[u];
      black = dp[u][1];
    } else {
      any.push_back(u);
    }
  }
  vector<ll> dp2(5050, INF);
  dp2[white] = black;
  for (auto ch : any) {
    vector<ll> pd2(5050, INF);
    for (int i = 5000; i >= 0; i--) {
      if (dp2[i] != INF) {
        if (i + X[ch] < 5050) {
          pd2[i + X[ch]] = min(pd2[i + X[ch]], dp2[i] + dp[ch][1]);
        }
        if (i + dp[ch][0] < 5050)
          pd2[i + dp[ch][0]] = min(pd2[i + dp[ch][0]], dp2[i] + X[ch]);
      }
    }
    swap(dp2, pd2);
  }
  for (int i = 0; i < X[v] + 1; i++) {
    if (dp2[i] != INF) dp[v][0] = min(dp[v][0], dp2[i]);
  }
  dp2.resize(5050, INF);
  dp2[black] = INF;
  for (auto ch : any) {
    vector<ll> pd2(5050, INF);
    for (int i = 5000; i >= 0; i--) {
      if (dp2[i] != INF) {
        if (i + X[ch] < 5050)
          pd2[i + X[ch]] = min(pd2[i + X[ch]], dp2[i] + dp[ch][0]);
        if (i + dp[ch][1] < 5050)
          pd2[i + dp[ch][0]] = min(pd2[i + dp[ch][1]], dp2[i] + X[ch]);
      }
    }
    swap(dp2, pd2);
  }
  for (int i = 0; i < X[v] + 1; i++) {
    if (dp2[i] != INF) dp[v][1] = min(dp[v][1], dp2[i]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  Graph G(N);
  for (int i = 1; i < N; i++) {
    int P;
    cin >> P;
    P--;
    G[i].push_back(P);
    G[P].push_back(i);
  }
  vector<int> X(N);
  for (auto &it : X) cin >> it;
  vector<vector<ll>> dp(N + 1, vector<ll>(2, INF));
  dfs(G, dp, X, 0, -1);
  if (dp[0][0] == INF && dp[0][1] == INF)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
  return 0;
}
