#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1002003004;
const ll LINF = 1002003004005006007ll;
struct preprocess {
  preprocess() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} ____;
const int MX_N = 1005;
vector<vector<int>> to(MX_N);
vector<int> x(MX_N);
const int MX = 5005;
bool flag = true;
int dfs(int u) {
  if (to[u].size() == 0) {
    return x[u];
  }
  set<int> can;
  int res = 0;
  for (int v : to[u]) {
    int s = dfs(v);
    if (s == -1) return -1;
    res += s;
    if (can.empty()) {
      can.emplace(x[v]);
      can.emplace(s - x[v]);
    } else {
      set<int> cana;
      for (int i : can) {
        cana.emplace(min(MX, i + x[v]));
        cana.emplace(min(MX, i + s - x[v]));
      }
      for (int i : cana) {
        can.emplace(i);
      }
    }
  }
  if (*can.begin() > x[u]) {
    flag = false;
    return -1;
  } else {
    res += x[u] - *(--can.upper_bound(x[u]));
    return res;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    to[p].emplace_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  dfs(0);
  if (flag)
    cout << "POSSIBLE" << '\n';
  else
    cout << "IMPOSSIBLE" << '\n';
}
