#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LLINF = 1e18;
static const double pi = 3.141592653589793;
int N, X[1009];
vector<int> G[1009];
int dp(vector<int> nums, int k) {
  if (k == 0) return 0;
  set<int> now;
  now.insert(0);
  for (auto x : nums) {
    if (x == 0) continue;
    set<int> nxt;
    for (auto y : now) {
      nxt.insert(y);
      if (x + y > k) continue;
      nxt.insert(x + y);
    }
    swap(now, nxt);
  }
  int mx = 0;
  for (auto x : now)
    if (mx < x) mx = x;
  return mx;
}
pair<int, int> dfs(int u) {
  vector<int> nums;
  int sm = 0, bg = 0;
  for (int v : G[u]) {
    pair<int, int> p = dfs(v);
    if (p.first == -1) return {-1, -1};
    sm += p.first;
    bg += p.second;
    nums.push_back(p.second - p.first);
  }
  if (sm > X[u]) return {-1, -1};
  if (bg <= X[u]) return {min(sm, X[u]), max(sm, X[u])};
  int n = dp(nums, X[u] - sm);
  sm += n;
  bg -= n;
  if (sm < bg) swap(sm, bg);
  if (bg > X[u]) return {-1, -1};
  return {min(sm, X[u]), max(sm, X[u])};
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  for (int v = 2; v <= N; v++) {
    int u;
    cin >> u;
    G[u].push_back(v);
  }
  for (int i = 1; i <= N; i++) {
    cin >> X[i];
  }
  pair<int, int> ans = dfs(1);
  if (ans.first != -1) {
    cout << "POSSIBLE" << endl;
    ;
  } else {
    cout << "IMPOSSIBLE" << endl;
    ;
  }
}
