#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
template <class T>
void chmin(T &a, T b) {
  if (a > b) a = b;
}
const int MN = 1010;
const int MM = 5010;
vector<int> g[MN];
int n;
int x[MN];
int dp[MM], mw[MN];
void imp() {
  cout << "IMPOSSIBLE\n";
  exit(0);
}
void dfs(int v, int p) {
  for (int i = 0; i < int(g[v].size()); i++) {
    int u = g[v][i];
    if (u == p) continue;
    dfs(u, v);
  }
  fill(dp, dp + x[v] + 1, INF);
  for (int i = 0; i < int(g[v].size()); i++) {
    int u = g[v][i];
    if (u == p) continue;
    for (int j = 0; j <= x[v]; j++) {
      if (j + x[u] <= x[v]) {
        if (dp[j] == INF && j) continue;
        int y = (dp[j] < INF) ? dp[j] : 0;
        chmin(dp[j + x[u]], y + mw[u]);
      }
      if (j + mw[u] <= x[v]) {
        if (dp[j] == INF && j) continue;
        int y = (dp[j] < INF) ? dp[j] : 0;
        chmin(dp[j + mw[u]], y + x[u]);
      }
    }
  }
  if (int(g[v].size()) == 0) {
    mw[v] = 0;
  } else {
    mw[v] = *min_element(dp, dp + x[v] + 1);
  }
  if (mw[v] == INF) imp();
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    g[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  dfs(0, -1);
  cout << "POSSIBLE\n";
  return 0;
}
