#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int t, next;
  Edge() {}
  Edge(int a, int b) : t(a), next(b) {}
};
Edge e[1005];
int head[1005], num[1005];
bool can[2][5005];
int f[1005];
bool dfs(int x) {
  int cur = 0, sum = 0;
  memset(can[cur], 0, sizeof(can[cur]));
  can[cur][0] = 1;
  for (int i = head[x]; i; i = e[i].next) {
    int u = e[i].t;
    if (!dfs(u)) return 0;
    cur ^= 1;
    memset(can[cur], 0, sizeof(can[cur]));
    for (int j = num[u]; j <= num[x]; j++)
      can[cur][j] |= can[cur ^ 1][j - num[u]];
    for (int j = f[u]; j <= num[x]; j++) can[cur][j] |= can[cur ^ 1][j - f[u]];
    sum += num[u] + f[u];
  }
  for (int i = num[x]; i >= 0; i--)
    if (can[cur][i]) {
      f[x] = sum - i;
      return 1;
    }
  return 0;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    e[i] = Edge(i, head[x]);
    head[x] = i;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
  puts((dfs(1)) ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
