#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T& a, T const& b) {
  a = max(a, b);
}
template <class T>
inline void chmin(T& a, T const& b) {
  a = min(a, b);
}
using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
const int mod = 1e9 + 7, INF = 1 << 30;
const double EPS = 1e-12, PI = 3.1415926535897932384626;
const ll lmod = 1e9 + 7, LINF = 1LL << 60;
const int MAX_N = 100005;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vvi graph(N);
  for (int i = 1; i < N; i++) {
    int p;
    cin >> p;
    p--;
    graph[i].push_back(p);
    graph[p].push_back(i);
  }
  vi x(N), a(N);
  for (int i = 0; i < N; i++) cin >> x[i];
  bitset<int(6e6 + 1)> dp;
  function<bool(int, int)> solve = [&](int u, int p) {
    for (auto v : graph[u]) {
      if (v == p) continue;
      if (!solve(v, u)) return false;
    }
    dp.reset();
    dp[0] = 1;
    int ss = 0;
    for (auto v : graph[u]) {
      if (v == p) continue;
      dp = (dp << x[v]) | (dp << a[v]);
      ss += x[v] + a[v];
    }
    for (int j = x[u]; j >= 0; j--) {
      if (dp[j]) {
        a[u] = ss - j;
        cout << " u:" << u + 1 << " a:" << a[u] << " ss:" << ss << endl;
        return true;
      }
    }
    return false;
  };
  cout << (solve(0, -1) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}
