#include <bits/stdc++.h>
char _;
using namespace std;
int N, first[1005], u, dp[1005], knap[1005][5005];
vector<int> adj[1005];
bool v = 1;
int knapsack(int i, int j, int k) {
  if (adj[i].size() <= j) {
    return 0;
  }
  u = adj[i][j];
  if (knap[j][k] != -1) {
    return knap[j][k];
  }
  int ret = 1 << 25;
  if (k - first[u] >= 0) {
    ret = min(ret, knapsack(i, j + 1, k - first[u]) + dp[u]);
  }
  if (k - dp[u] >= 0) {
    ret = min(ret, knapsack(i, j + 1, k - dp[u]) + first[u]);
  }
  return knap[j][k] = ret;
}
void dfs(int i) {
  if (adj[i].empty()) {
    dp[i] = 0;
    return;
  }
  for (int j = 0; j < adj[i].size(); j++) {
    dfs(adj[i][j]);
  }
  for (int j = 0; j < adj[i].size(); j++) {
    for (int k = 0; k <= first[i]; k++) {
      knap[j][k] = -1;
    }
  }
  dp[i] = knapsack(i, 0, first[i]);
}
int main() {
  scanf("%d", &N);
  for (int i = 2; i <= N; i++) {
    scanf("%d", &u);
    adj[u].push_back(i);
  }
  for (int i = 1; i <= N; i++) {
    scanf("%d", &first[i]);
  }
  memset(dp, -1, sizeof dp);
  dfs(1);
  printf("%s\n", dp[1] < (1 << 25) ? "POSSIBLE" : "IMPOSSIBLE");
}
