#include <bits/stdc++.h>
using namespace std;
const int INF10 = 1000000001, ID_MAX = 20;
const long mod = 100000009;
const long long INF18 = 100000000000000001;
struct edge {
  int to;
  vector<int> child;
  long cost;
};
void sort2array(double *a, long *b, long n) {
  for (int i = 0; i < n; i++) {
    b[i] = i;
  }
  sort(b, b + n, [a](long i, long j) -> bool { return a[i] < a[j]; });
}
int wtover(int a, int b) {
  if (a % b > 0)
    return (a / b) + 1;
  else
    return a / b;
}
int bi_e[ID_MAX] = {0};
int bi_max(long n) {
  int m = 0;
  for (m; (1 << m) <= n; m++)
    ;
  m = m - 1;
  return m;
}
void bi_exs(long n) {
  memset(bi_e, 0, sizeof(bi_e));
  if (n < (1 << ID_MAX)) {
    for (int i = 0; n > 0; n = (n >> 1), i++) bi_e[i] = n & 1;
  }
}
long myPow(long x, long n, long m) {
  if (n < 0) return 0;
  if (n == 0) return 1;
  if (n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}
struct node {
  int to;
  vector<int> child;
  pair<int, int> weight;
  int color;
  bool leaforn() { return child.empty(); }
  int sizeofchild() { return child.size(); }
};
const int N_MAX = 1002;
long int n, x[N_MAX], larger[N_MAX], dp[5002];
node v[N_MAX];
int rec(int m, int k) {
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  for (int i = 0; i < k; i++) {
    for (int j = m - larger[k]; j >= 0; j--) {
      if (dp[j] != 0) dp[j + larger[i]] = 1;
    }
  }
  int res;
  for (int i = 0; i < (int)(m + 1); i++) {
    if (dp[i] > 0) {
      res = i;
    }
  }
  return res;
}
int solve() {
  queue<int> que;
  stack<int> dq;
  que.push(0);
  while (que.size()) {
    int w = que.front();
    dq.push(w);
    que.pop();
    for (int i = 0; i < (int)(v[w].child.size()); i++) {
      que.push(v[w].child.at(i));
    }
  }
  while (dq.size()) {
    int w = dq.top();
    dq.pop();
    if (v[w].leaforn()) {
      v[w].weight.first = x[w];
      v[w].weight.second = 0;
      continue;
    }
    long int m, sumn = 0, sum = 0;
    memset(larger, 0, sizeof(larger));
    for (int i = 0; i < (int)(v[w].child.size()); i++) {
      larger[i] =
          v[v[w].child.at(i)].weight.first - v[v[w].child.at(i)].weight.second;
      sumn += v[v[w].child.at(i)].weight.second;
      sum +=
          v[v[w].child.at(i)].weight.first + v[v[w].child.at(i)].weight.second;
    }
    if (sumn > x[w]) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
    m = x[w] - sumn;
    long int res = rec(m, v[w].child.size());
    v[w].weight.first = max(x[w], sum - res - sumn);
    v[w].weight.second = min(x[w], sum - res - sumn);
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
int main() {
  int i, y;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> y;
    v[y - 1].child.push_back(i);
    v[i].to = y - 1;
  }
  for (int i = 0; i < (int)(n); i++) {
    cin >> x[i];
  }
  solve();
}
