#include <bits/stdc++.h>
using namespace std;
struct Tree {
  long long index;
  long long a, b;
  vector<Tree*> childlen;
};
long long N;
Tree tree[1000];
long long X[1000];
long long dp[1000][5001];
vector<Tree*>* current;
long long currentX;
long long func(long long n, long long sum) {
  if (sum < 0) {
    return INT_MAX;
  }
  if (dp[n][sum] >= 0) {
    return dp[n][sum];
  }
  long long a = (*current)[n]->a;
  long long b = (*current)[n]->b;
  if (n == 0) {
    if (sum == b) return a;
    if (sum == a) return b;
    return INT_MAX;
  }
  long long n1 = func(n - 1, sum - a) + b;
  long long n2 = func(n - 1, sum - b) + a;
  long long m = min(n1, n2);
  dp[n][sum] = m;
  return m;
}
void dfs(Tree& tree) {
  if (tree.childlen.empty()) {
    tree.a = X[tree.index];
    tree.b = 0;
    return;
  }
  for (Tree* c : tree.childlen) {
    dfs(*c);
  }
  memset(dp, -1L, sizeof(dp));
  current = &tree.childlen;
  currentX = X[tree.index];
  long long min = INT_MAX;
  for (long long i = 0; i <= currentX; i++) {
    min = (((min) < (func(tree.childlen.size() - 1, i)))
               ? (min)
               : (func(tree.childlen.size() - 1, i)));
  }
  if (min == INT_MAX) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
  tree.a = currentX;
  tree.b = min;
}
signed main() {
  cin >> N;
  for (long long(i) = 0; (i) < (N - 1); (i)++) {
    long long p;
    cin >> p;
    tree[p - 1].childlen.push_back(&tree[i + 1]);
    tree[i + 1].index = i + 1;
  }
  for (long long(i) = 0; (i) < (N); (i)++) cin >> X[i];
  dfs(tree[0]);
  cout << "POSSIBLE" << endl;
}
