#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
inline bool chmax(A &a, B b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename A, typename B>
inline bool chmin(A &a, B b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1e9 + 100;
const long long MOD = 1e9;
const double EPS = 1e-10;
const bool debug = 0;
int N;
int P[1000], X[1000];
int dp[1000][5001];
vector<int> g[1000];
void dfs(int u) {
  bool f = false;
  for (int i = (0); i < (g[u].size()); i++) {
    dfs(g[u][i]);
    if (!f) {
      for (int j = (0); j < (5001); j++) dp[i][j] = dp[g[u][i]][j];
      f = true;
    } else {
      vector<pair<int, int> > v1, v2;
      for (int j = (0); j < (5001); j++)
        if (dp[u][j] != INF) v1.push_back(pair<int, int>(j, dp[u][j]));
      for (int j = (0); j < (5001); j++)
        if (dp[g[u][i]][j] != INF)
          v2.push_back(pair<int, int>(j, dp[g[u][i]][j]));
      for (int j = (0); j < (v1.size()); j++)
        for (int k = (0); k < (v2.size()); k++) {
          int sum1 = v1[j].first + v2[k].first;
          int sum2 = v1[j].second + v2[k].second;
          if (sum1 <= 5000) chmin(dp[u][sum1], sum2);
        }
    }
  }
  if (g[u].size() == 0) {
    dp[u][X[u]] = 0;
    dp[u][0] = X[u];
    return;
  }
  int mi = INF;
  for (int i = (0); i < (X[u] + 1); i++) chmin(mi, dp[u][i]);
  for (int i = (0); i < (5001); i++) {
    if (dp[u][i] <= X[u])
      dp[u][i] = X[u];
    else
      dp[u][i] = INF;
  }
  chmin(dp[u][X[u]], mi);
}
int main() {
  cin >> N;
  for (int i = (1); i < (N); i++) scanf("%d", P + i);
  for (int i = (0); i < (N); i++) scanf("%d", X + i);
  for (int i = (1); i < (N); i++) {
    P[i]--;
    g[P[i]].push_back(i);
  }
  fill(dp[0], dp[N], INF);
  dfs(0);
  bool ans = false;
  for (int i = (0); i < (5001); i++)
    if (dp[0][i] != INF) ans = true;
  puts(ans ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
