#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
const int MAXX = 5005;
const int INF = (long long)1e9 + 5;
int X[MAXN], minv[MAXN], dp[MAXX], N;
vector<int> ch[MAXN];
void nope() {
  cout << "IMPOSSIBLE\n";
  exit(EXIT_SUCCESS);
}
void dfs(int v) {
  if (ch[v].empty()) {
    minv[v] = 0;
    return;
  }
  fill(dp, dp + 5001, INF);
  dp[0] = 0;
  for (int to : ch[v]) {
    dfs(to);
    int c1 = X[to], c2 = minv[to];
    for (int j = 5000; j >= 0; j--) {
      int a = INF, b = INF;
      if (j >= c1) a = dp[j - c1] + c2;
      if (j >= c2) b = dp[j - c2] + c1;
      dp[j] = min(a, b);
    }
  }
  minv[v] = *min_element(dp, dp + X[v] + 1);
  if (minv[v] == INF) {
    nope();
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  for (int i = 2; i <= N; i++) {
    int p;
    cin >> p;
    ch[p].push_back(i);
  }
  for (int i = 1; i <= N; i++) cin >> X[i];
  dfs(1);
  cout << "POSSIBLE\n";
  return 0;
}
