#include <bits/stdc++.h>
using namespace std;
inline int Read() {
  int x = 0, f = 1, c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 1005;
const int MAXM = 5005;
const int INF = 0x3f3f3f3f;
int n, a[MAXN], par[MAXN], f[MAXN][MAXM];
int main() {
  n = Read();
  for (int i = 2; i <= n; i++) par[i] = Read();
  for (int i = 1; i <= n; i++) a[i] = Read();
  for (int i = n; i; i--) {
    int val = INF;
    for (int j = 0; j <= a[i]; j++) val = min(val, f[i][j]);
    if (val == INF) return puts("IMPOSSIBLE"), 0;
    for (int j = a[par[i]]; ~j; j--) {
      int cur = INF;
      if (j >= val) cur = min(cur, f[par[i]][j - val] + a[i]);
      if (j >= a[i]) cur = min(cur, f[par[i]][j - a[i]] + cur);
      f[par[i]][j] = cur;
    }
  }
  return puts("POSSIBLE"), 0;
}
