#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
const double eps = 1e-10;
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
class Union_find {
 private:
  vector<int> par;
  vector<int> rank;
  int n;

 public:
  Union_find(int a) {
    n = a;
    for (int i = 0; i < n; i++) {
      par.push_back(i);
      rank.push_back(0);
    }
  }
  int find(int x) {
    if (par[x] == x) {
      return x;
    } else {
      return par[x] = find(par[x]);
    }
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank[x] < rank[y]) {
      par[x] = y;
    } else {
      par[y] = x;
      if (rank[x] == rank[y]) rank[x]++;
    }
  }
  bool same(int x, int y) { return find(x) == find(y); }
};
vector<int> G[1010];
int x[1010];
int sum[1010] = {};
int dfs1(int v, int p) {
  sum[v] += x[v];
  for (int i = 0; i < (G[v].size()); i++) {
    if (G[v][i] == p) continue;
    sum[v] += dfs1(G[v][i], v);
  }
  return sum[v];
}
PII dfs2(int v, int p) {
  if (G[v].size() == 1 && p != -1) {
    return {x[v], 0};
  } else if (G[v].size() == 0) {
    return {x[v], 0};
  }
  vector<PII> vs;
  for (int i = 0; i < (G[v].size()); i++) {
    if (G[v][i] == p) continue;
    vs.push_back(dfs2(G[v][i], v));
  }
  map<int, int> mp;
  mp[vs[0].first] = vs[0].second;
  mp[vs[0].second] = vs[0].first;
  for (int i = (1); i < (vs.size()); i++) {
    map<int, int> mp2;
    for (auto pp : mp) {
      if (pp.first + vs[i].first <= x[v])
        mp2[pp.first + vs[i].first] =
            min(mp2[pp.first + vs[i].first], mp[pp.first] + vs[i].second);
      if (pp.first + vs[i].second <= x[v])
        mp2[pp.first + vs[i].second] =
            min(mp2[pp.first + vs[i].second], mp[pp.first] + vs[i].first);
    }
    mp = mp2;
  }
  PII res = {(ll)1e9, (ll)1e9};
  for (auto pp : mp) {
    if (pp.first > x[v]) continue;
    if (res.second > pp.second) res = {x[v], pp.second};
  }
  return res;
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  for (int i = 0; i < (N - 1); i++) {
    int p;
    cin >> p;
    G[i + 1].push_back(p - 1);
    G[p - 1].push_back(i + 1);
  }
  for (int i = 0; i < (N); i++) {
    cin >> x[i];
  }
  dfs1(0, -1);
  PII res = dfs2(0, -1);
  if (min(res.first, res.second) <= x[0]) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}
