#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int INF = 1e9;
using pii = pair<int, int>;
using graph = vector<vector<int>>;
bool rec(int v, graph const& g, vector<int>& dp, vector<int> const& X) {
  if (g[v].size() == 0) {
    dp[v] = 0;
    return true;
  }
  vector<vector<int>> dp2(g[v].size() + 1, vector<int>(X[v] + 1, INF));
  dp2[0][0] = 0;
  for (int i = 0; i < (int)g[v].size(); ++i) {
    int ch = g[v][i];
    if (!rec(ch, g, dp, X)) {
      return false;
    }
    for (int j = 0; j <= X[v]; ++j) {
      if (dp2[i][j] == INF) {
        continue;
      }
      if (j + X[ch] <= X[v]) {
        dp2[i + 1][j + X[ch]] = min(dp2[i + 1][j + X[ch]], dp2[i][j] + dp[ch]);
      }
      if (j + dp[ch] <= X[v]) {
        dp2[i + 1][j + dp[ch]] = min(dp2[i + 1][j + dp[ch]], dp2[i][j] + X[v]);
      }
    }
  }
  bool check = false;
  for (int i = 0; i <= X[v]; ++i) {
    if (dp2[g[v].size()][i] != INF) {
      dp[v] = min(dp[v], dp2[g[v].size()][i]);
      check = true;
    }
  }
  return check;
}
int main() {
  int N;
  cin >> N;
  vector<vector<int>> g(N);
  for (int i = 0; i < N - 1; ++i) {
    int p;
    cin >> p;
    g[p - 1].push_back(i + 1);
  }
  vector<int> X(N);
  for (int i = 0; i < N; ++i) {
    cin >> X[i];
  }
  vector<int> dp(N, INF);
  if (rec(0, g, dp, X)) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}
