#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e15;
const long long int MOD = 1e9 + 7;
long long int n;
vector<vector<long long int>> edge;
vector<long long int> x;
pair<long long int, long long int> dfs(long long int v) {
  long long int sum = 0;
  long long int y = x[v];
  vector<pair<long long int, long long int>> vp;
  for (long long int u : edge[v]) {
    vp.push_back(dfs(u));
  }
  sort((vp).begin(), (vp).end(), greater<pair<long long int, long long int>>());
  for (pair<long long int, long long int> p : vp) {
    if (y >= p.first) {
      y -= p.first;
      sum += p.second;
    } else {
      y -= p.second;
      sum += p.first;
    }
  }
  if (y < 0) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
  pair<long long int, long long int> ans = {x[v], sum};
  if (ans.first < ans.second) {
    swap(ans.first, ans.second);
  }
  return ans;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  edge = vector<vector<long long int>>(n + 1, vector<long long int>());
  for (long long int i = 2; i <= n; i++) {
    long long int p;
    cin >> p;
    edge[p].push_back(i);
  }
  x = vector<long long int>(n + 1);
  for (long long int i = 0; i < (n); ++i) cin >> x[i + 1];
  dfs(1);
  cout << "POSSIBLE" << endl;
  return 0;
}
