#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > graph;
int N;
const int MAX_N = 1001;
const int MAX_X = 5001;
int p[MAX_N], x[MAX_N], y[MAX_N];
bool dp[MAX_N][MAX_X];
int a[MAX_N], b[MAX_N];
bool dfs(int v) {
  bool isLeaf = true;
  for (int u : graph[v]) {
    if (u == p[v]) continue;
    if (!dfs(u)) return false;
    isLeaf = false;
  }
  if (isLeaf) return true;
  int j = 1, sum = 0, M = -1;
  dp[0][0] = 1;
  for (int u : graph[v]) {
    if (u == p[v]) continue;
    sum += x[u] + y[u];
    for (int i = 0; i <= x[v]; i++) {
      if (i >= x[u]) dp[j][i] |= dp[j - 1][i - x[u]];
      if (i >= y[u]) dp[j][i] |= dp[j - 1][i - y[u]];
      if (dp[j][i]) M = max(M, i);
    }
    j++;
  }
  if (M < 0) {
    puts("IMPOSSIBLE");
    return false;
  }
  y[v] = sum - M;
  j = 1;
  for (int u : graph[v]) {
    if (u == p[v]) continue;
    for (int i = 0; i <= x[v]; i++) dp[j][i] = 0;
    j++;
  }
  return true;
}
int main() {
  dp[0][0] = 1;
  scanf("%d", &N);
  graph.assign(N + 1, vector<int>());
  for (int i = 2; i <= N; i++) {
    scanf("%d", &p[i]);
    graph[i].push_back(p[i]);
    graph[p[i]].push_back(i);
  }
  for (int i = 1; i <= N; i++) {
    scanf("%d", &x[i]);
  }
  if (dfs(1)) puts("POSSIBLE");
  return 0;
}
