#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using ld = long double;
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (ll i = ll(0); i < ll((ll)v.size()); i++) {
    if (i) os << ",";
    os << v[i];
  }
  os << "]";
  return os;
}
ll read() {
  ll i;
  scanf("%lld", &i);
  return i;
}
void printSpace() { printf(" "); }
void printEoln() { printf("\n"); }
void print(ll x, ll suc = 1) {
  printf("%lld", x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}
string readString() {
  static char buf[3341919];
  scanf("%s", buf);
  return string(buf);
}
char* readCharArray() {
  static char buf[3341919];
  static ll bufUsed = 0;
  char* ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}
template <class T, class U>
void chmax(T& a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
void chmin(T& a, U b) {
  if (a > b) a = b;
}
template <class T>
T Sq(const T& t) {
  return t * t;
}
const ll inf = LLONG_MAX / 3;
const ll Nmax = 1145;
const ll Vmax = 5140;
vi ch[Nmax];
ll x[Nmax];
bool dp[Vmax];
void Muri() {
  cout << "IMPOSSIBLE" << endl;
  exit(0);
}
pi dfs(ll v) {
  vector<pi> ws;
  for (auto c : ch[v]) ws.push_back(dfs(c));
  ll sum = 0;
  for (auto w : ws) sum += w.first + w.second;
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  ll base = 0;
  for (auto w : ws) {
    ll a = w.first, b = w.second;
    base += min(a, b);
    a = max(a, b) - min(a, b);
    for (ll i = ll(a); i < ll(Vmax); i++)
      if (dp[i - a]) dp[i] = 1;
  }
  ll ad = -1;
  for (ll i = ll(0); i < ll(x[v] - base + 1); i++)
    if (dp[i]) ad = x[v] - base - i;
  if (ad == -1) Muri();
  return pi(sum + ad - x[v], x[v]);
}
signed main() {
  ll n = read();
  for (ll i = ll(1); i < ll(n); i++) {
    ll p = read() - 1;
    ch[p].push_back(i);
  }
  for (ll i = ll(0); i < ll(n); i++) x[i] = read();
  dfs(0);
  cout << "POSSIBLE" << endl;
}
