#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void chmin(T &a, T b) {
  a = min(a, b);
}
template <typename T>
void chadd(T &a, T b) {
  a = a + b;
}
long long int dx[] = {0, 0, 1, -1};
long long int dy[] = {1, -1, 0, 0};
constexpr long long INF = 1001001001001001LL;
constexpr long long MOD = 1000000007LL;
const long long int MAXN = 1010;
const long long int MAXX = 5010;
vector<long long int> G[MAXN];
long long int N, x[MAXN], dp[MAXN], dp2[MAXN][MAXX];
bool ok = true;
long long int solve_dp(vector<long long int> &a, vector<long long int> &b,
                       long long int &lim) {
  long long int M = a.size();
  for (long long int(i) = (0); (i) < (MAXN); (i)++)
    for (long long int(j) = (0); (j) <= (lim); (j)++) dp2[i][j] = INF;
  dp2[0][0] = 0;
  for (long long int(i) = (0); (i) < (M); (i)++)
    for (long long int(j) = (0); (j) <= (lim); (j)++) {
      if (dp2[i][j] == INF) continue;
      if (j + a[i] <= lim) {
        chmin(dp2[i + 1][j + a[i]], dp2[i][j] + b[i]);
      }
      if (j + b[i] <= lim) {
        chmin(dp2[i + 1][j + b[i]], dp2[i][j] + a[i]);
      }
    }
  return *min_element(dp2[M], dp2[M] + lim + 1);
}
void solve(long long int p, long long int par = -1) {
  bool leaf = true;
  vector<long long int> a, b;
  for (auto to : G[p]) {
    if (to == par) continue;
    leaf = false;
    solve(to, p);
    a.push_back(x[to]);
    b.push_back(dp[to]);
  }
  if (leaf)
    dp[p] = 0;
  else {
    long long int val = solve_dp(a, b, x[p]);
    if (val == INF) {
      ok = false;
      return;
    }
    dp[p] = val;
  }
}
signed main() {
  cin >> N;
  for (long long int(i) = (0); (i) < (N - 1); (i)++) {
    long long int p;
    cin >> p;
    p--;
    G[p].push_back(i + 1);
  }
  for (long long int(i) = (0); (i) < (N); (i)++) {
    cin >> x[i];
    dp[i] = INF;
  }
  solve(0);
  cout << (!ok ? "IMPOSSIBLE" : "POSSIBLE") << endl;
  return 0;
}
