#include <bits/stdc++.h>
using namespace std;
vector<int> G[1000];
vector<int> x;
pair<int, int> dfs(int cur) {
  if (G[cur].size() == 0) return pair<int, int>(x[cur], 0);
  static int dp[6000];
  for (long long i = 0; i < (long long)(6000); i++) dp[i] = (1e9 + 1);
  dp[0] = 0;
  for (auto e : G[cur]) {
    pair<int, int> res = dfs(e);
    for (long long j = 0; j < (long long)(6001); j++) {
      if (j + res.first <= 6000) {
        dp[j + res.first] = min(dp[j + res.first], dp[j] + res.second);
      }
      if (j + res.second <= 6000) {
        dp[j + res.second] = min(dp[j + res.first], dp[j] + res.first);
      }
    }
  }
  return pair<int, int>(x[cur], dp[x[cur]]);
}
int main() {
  int n;
  cin >> n;
  for (long long i = 0; i < (long long)(n - 1); i++) {
    int p;
    cin >> p;
    G[p - 1].emplace_back(i + 1);
  }
  x.resize(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> x[i];
  pair<int, int> res = dfs(0);
  if (res.second > res.first)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
}
