#include <bits/stdc++.h>
using namespace std;
template <typename T0, typename T1>
std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) {
  for (typename map<T0, T1>::const_iterator p = v.begin(); p != v.end(); p++) {
    os << p->first << ": " << p->second << " ";
  }
  return os;
}
template <typename T0, typename T1>
std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) {
  os << v.first << ": " << v.second << " ";
  return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const vector<T>& v) {
  for (int i = 0; i < (int)v.size(); i++) {
    os << v[i] << " ";
  }
  return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) {
  for (int i = 0; i < (int)v.size(); i++) {
    os << v[i] << endl;
  }
  return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const set<T>& v) {
  vector<T> tmp(v.begin(), v.end());
  os << tmp;
  return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const deque<T>& v) {
  vector<T> tmp(v.begin(), v.end());
  os << tmp;
  return os;
}
long long N;
vector<vector<long long> > g;
vector<long long> X;
vector<long long> dp;
bool ans;
void dfs(int idx) {
  long long minSum = 0;
  long long all = 0;
  vector<long long> ds;
  for (int i = 0, _n = (g[idx].size()); (i) < (int)_n; ++i) {
    int ch = g[idx][i];
    dfs(ch);
    long long Min = min(X[ch], dp[ch]);
    long long Max = max(X[ch], dp[ch]);
    minSum += Min;
    ds.push_back(Max - Min);
    all += X[ch] + dp[ch];
  }
  sort((ds).begin(), (ds).end());
  for (long long d : ds) {
    if (minSum + d > X[idx]) break;
    minSum += d;
  }
  if (minSum > X[idx]) ans = 0;
  dp[idx] = all - minSum;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long p;
  while (cin >> N) {
    g = vector<vector<long long> >(N);
    for (int i = 0, _n = (N - 1); (i) < (int)_n; ++i) {
      cin >> p;
      p--;
      g[p].push_back(i + 1);
    }
    X = vector<long long>(N);
    for (int i = 0, _n = (N); (i) < (int)_n; ++i) cin >> X[i];
    dp = vector<long long>(N, (1LL << 60));
    ans = 1;
    dfs(0);
    cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  }
  return 0;
}
