#include <bits/stdc++.h>
using namespace std;
bitset<5000000> bit;
int main() {
  long long n;
  cin >> n;
  vector<vector<long long>> g(n);
  for (long long i = 0; i < (long long)(n - 1); i++) {
    long long p;
    cin >> p;
    g[i + 1].push_back(p - 1);
    g[p - 1].push_back(i + 1);
  }
  vector<pair<long long, long long>> x(n);
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> x[i].first;
  }
  long long root = 0;
  vector<vector<long long>> child(n);
  vector<long long> par(n);
  queue<long long> q;
  queue<long long> qq;
  q.push(root);
  par[root] = -1;
  while (!q.empty()) {
    long long p = q.front();
    q.pop();
    if (g[p].size() == 1 && p != root) {
      qq.push(p);
    }
    for (auto r : g[p]) {
      if (r == par[p]) continue;
      par[r] = p;
      q.push(r);
    }
  }
  while (!qq.empty()) {
    long long p = qq.front();
    qq.pop();
    child[par[p]].push_back(p);
    if (child[par[p]].size() == g[par[p]].size()) {
      long long sum = 0;
      for (auto r : child[par[p]]) {
        sum += x[r].first + x[r].second;
      }
      bit.reset();
      bit[0] = 1;
      for (auto r : child[par[p]]) {
        bit = (bit << x[r].first) | (bit << x[r].second);
      }
      long long mx = -1;
      for (long long i = 0; i < (long long)(x[par[p]].first); i++) {
        if (bit[i]) mx = i;
      }
      if (mx == -1) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
      } else {
        x[par[p]].second = sum - mx;
      }
    }
    if (child[par[p]].size() == g[par[p]].size() - 1 && par[p] != root) {
      long long sum = 0;
      for (auto r : child[par[p]]) {
        sum += x[r].first + x[r].second;
      }
      bit.reset();
      bit[0] = 1;
      for (auto r : child[par[p]]) {
        bit = (bit << x[r].first) | (bit << x[r].second);
      }
      long long mx = -1;
      for (long long i = 0; i < (long long)(x[par[p]].first + 1); i++) {
        if (bit[i]) mx = i;
      }
      if (mx == -1) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
      } else {
        x[par[p]].second = sum - mx;
      }
      qq.push(par[p]);
    }
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
