#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int M = 5050;
const int INF = 1e9;
int n, __nico_x[N];
vector<int> adj[N];
int dp[N], knap[2][M];
void dfs(int u) {
  auto act = knap[0], nxt = knap[1];
  int sz = 0, sum = 0;
  act[sz++] = 1;
  for (int v : adj[u]) {
    dfs(v);
    if (dp[v] == INF) return void(dp[u] = INF);
    int a = __nico_x[v], b = dp[v] - __nico_x[v];
    sum += dp[v];
    int nsz = min(__nico_x[u] + 1, sz + max(a, b));
    fill_n(nxt, nsz, 0);
    for (int i = 0; i < (int)(sz); i++)
      if (act[i]) {
        if (i + a <= __nico_x[u]) nxt[i + a] = 1;
        if (i + b <= __nico_x[u]) nxt[i + b] = 1;
      }
    sz = nsz;
    swap(act, nxt);
  }
  int best = __nico_x[u];
  while (best >= 0 && !act[best]) best--;
  if (best < 0)
    dp[u] = INF;
  else
    dp[u] = sum + __nico_x[u] - best;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int v = (int)(1); v < ((int)n); v++) {
    int u;
    cin >> u;
    adj[u - 1].push_back(v);
  }
  for (int i = 0; i < (int)(n); i++) cin >> __nico_x[i];
  dfs(0);
  cout << (dp[0] == INF ? "IMPOSSIBLE" : "POSSIBLE") << endl;
  return 0;
}
