#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const long long MOD = 1000000000 + 7;
constexpr long long INF = 1LL << 60;
const double PI = acos(-1);
struct Tll {
  LL first, second, third;
};
struct Fll {
  LL first, second, third, fourth;
};
void YN(bool f) {
  if (f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
void yn(bool f) {
  if (f)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
struct Edge {
  LL to, cost;
};
struct edge {
  LL from, to, cost;
};
vector<vector<Edge>> g;
vector<edge> ed;
vector<pair<LL, LL>> pv;
set<LL> st;
map<pair<LL, LL>, LL> ma;
int di[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
string str, ss;
bool f;
LL n, m, s, t, h, w, k, q, p, ans, cnt, sum, a[5000], b[5000];
char c;
pair<LL, LL> dfs(int cur, int par) {
  vector<vector<LL>> dp(g[cur].size() + 1, vector<LL>(5002));
  vector<pair<LL, LL>> d(g[cur].size());
  for (LL i = 0; i < g[cur].size() + 1; i++)
    for (LL j = 0; j < 5002; j++) dp[i][j] = INF;
  for (LL i = 0; i < g[cur].size(); i++) {
    d[i] = pair<LL, LL>(0, 0);
    int v = g[cur][i].to;
    if (v == par) continue;
    d[i] = dfs(v, cur);
  }
  dp[0][0] = 0;
  for (LL i = 0; i < g[cur].size(); i++) {
    for (LL j = 0; j < 5002; j++) {
      if (j + d[i].first <= 5000) {
        dp[i + 1][j + d[i].first] =
            min(dp[i + 1][j + d[i].first], dp[i][j] + d[i].second);
      } else {
        dp[i + 1][5001] = min(dp[i + 1][5001], dp[i][j] + d[i].second);
      }
      swap(d[i].first, d[i].second);
      if (j + d[i].first <= 5000) {
        dp[i + 1][j + d[i].first] =
            min(dp[i + 1][j + d[i].first], dp[i][j] + d[i].second);
      } else {
        dp[i + 1][5001] = min(dp[i + 1][5001], dp[i][j] + d[i].second);
      }
      swap(d[i].first, d[i].second);
    }
  }
  pair<LL, LL> res(0, 0);
  for (LL i = 0; i < 5002; i++) {
    if (a[cur] >= dp[g[cur].size()][i]) {
      res.first = a[cur];
      res.second = i;
      return res;
    }
  }
  f = 1;
  cout << cur << endl;
  return res;
}
int main() {
  cin >> n;
  g.resize(n);
  for (LL i = 0; i < n - 1; i++) {
    LL x;
    cin >> x;
    x--;
    g[x].push_back(Edge{i + 1, 0});
    g[i + 1].push_back(Edge{x, 0});
  }
  for (LL i = 0; i < n; i++) {
    cin >> a[i];
  }
  dfs(0, -1);
  if (f)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
  return 0;
}
