#include <bits/stdc++.h>
using namespace std;
const int maxn = 1009;
int head[1009];
struct edge {
  int to, next;
} edges[1009];
void addedge(int from, int to, int no) {
  edges[no].to = to;
  edges[no].next = head[from];
  head[from] = no;
}
int n;
bool xing;
int arr[maxn];
int mi[maxn], bian[maxn];
void sol(int o, int fa) {
  for (int i = head[o]; ~i; i = edges[i].next) {
    int to = edges[i].to;
    if (to == fa) continue;
    sol(to, o);
  }
  int ans = 0;
  int tol = 0;
  for (int i = head[o]; ~i; i = edges[i].next) {
    int to = edges[i].to;
    if (to != fa) ans += mi[to], tol += bian[to];
  }
  if (ans > arr[o]) {
    printf("IMPOSSIBLE\n");
    exit(0);
  }
  bool mark[5009] = {0};
  mark[0] = 1;
  for (int i = head[o]; ~i; i = edges[i].next) {
    int to = edges[i].to;
    if (to == fa) continue;
    for (int j = arr[o] - ans; j >= bian[to]; j--) {
      mark[j] |= mark[j - bian[to]];
    }
  }
  for (int j = arr[o] - ans; j > -1; j--) {
    if (mark[j]) {
      tol += arr[o] - j - ans;
      int tmp = tol - arr[o];
      mi[o] = min(tmp, arr[o]);
      bian[o] = max(tmp, arr[o]) - mi[o];
      break;
    }
  }
}
int main() {
  scanf("%d", &n);
  int e;
  memset(head, -1, sizeof(head));
  for (int i = 2; i <= n; i++) {
    scanf("%d", &e);
    addedge(e, i, i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  sol(1, -1);
  printf("POSSIBLE\n");
}
