#include <bits/stdc++.h>
using namespace std;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long LINF = numeric_limits<long long>::max() / 3;
struct Double {
  double d;
  explicit Double(double x) : d(x) {}
};
ostream& operator<<(ostream& os, const Double x) {
  os << fixed << setprecision(20) << x.d;
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  os << "[";
  for (const auto& v : vec) {
    os << v << ",";
  }
  os << "]";
  return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
  os << "{";
  for (T v : st) os << v << ",";
  os << "}";
  return os;
}
template <typename T, typename U>
inline void chmax(T& x, U y) {
  if (y > x) x = y;
}
template <typename T, typename U>
inline void chmin(T& x, U y) {
  if (y < x) x = y;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
constexpr double eps = 1e-10;
constexpr long long mod = 1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using P = pair<long long, long long>;
long long N;
vector<vector<int>> g;
vector<long long> X;
P memo[1024];
bool dfs(int cur) {
  if (g[cur].size() == 0) {
    memo[cur] = make_pair(X[cur], 0);
    return true;
  } else {
    for (int v : g[cur])
      if (!dfs(v)) return false;
    long long sum = 0;
    for (auto v : g[cur]) {
      sum += memo[v].first + memo[v].second;
    }
    vector<bool> ex(X[cur] + 1, 0);
    for (int v : g[cur]) {
      auto p = memo[v];
      for (int i = X[cur]; i >= 0; i--) {
        if (i > 0 and ex[i] == 1) continue;
        if (i + p.first <= X[cur]) ex[i + p.first] = 1;
        if (i + p.second <= X[cur]) ex[i + p.second] = 1;
      }
    }
    long long mx = -1;
    for (int i = X[cur]; i >= 0; i--) {
      if (ex[i]) {
        mx = i;
        break;
      }
    }
    if (mx == -1) return false;
    memo[cur] = make_pair(X[cur], sum - mx);
    return true;
  }
}
int main() {
  cin >> N;
  g.resize(N);
  X.resize(N);
  for (int i = 1; i < N; i++) {
    long long p;
    cin >> p;
    p--;
    g[p].push_back(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> X[i];
  }
  if (dfs(0)) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}
