#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<int>> v(1010);
int x[1010];
bool used[1010];
bool pos = true;
array<int, 2> dfs(int p) {
  used[p] = 1;
  vector<array<int, 2>> a;
  int ret = 0;
  int sum = 0;
  for (auto i : v[p]) {
    if (!used[i]) {
      array<int, 2> get = dfs(i);
      a.push_back(get);
      if (get[0] > x[p] && get[1] > x[p]) pos = false;
      sum += get[0] + get[1];
    }
  }
  ret = sum;
  if (a.size()) {
    int m = a.size();
    vector<vector<int>> st(m + 1);
    st[0].push_back(0);
    for (int i = 0; i < m; i++) {
      if (st[i].size() == 0) pos = false;
      for (int j = 0; j < st[i].size(); j++) {
        if (st[i][j] + a[i][0] <= x[p]) st[i + 1].push_back(st[i][j] + a[i][0]);
        if (st[i][j] + a[i][1] <= x[p]) st[i + 1].push_back(st[i][j] + a[i][1]);
      }
    }
    if (st[m].size() == 0) pos = false;
    for (auto i : st[m]) {
      ret = min(ret, sum - i);
    }
  }
  return {x[p], ret};
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a;
    cin >> a;
    a--;
    v[i].push_back(a);
    v[a].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  dfs(0);
  if (pos) {
    cout << "POSSIBLE\n";
  } else
    cout << "IMPOSSIBLE\n";
}
