#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T& num) {
  num = 0;
  T f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') num = num * 10 + ch - '0', ch = getchar();
  num *= f;
}
int power(int x, int k, int p) {
  int res = 1;
  for (; k; k >>= 1, x = 1ll * x * x % p)
    if (k & 1) res = 1ll * res * x % p;
  return res;
}
int getgcd(int x, int y) { return !x ? y : getgcd(y % x, x); }
const int maxn = 1e3 + 5, inf = 1e9 + 5;
int n, tot, flag = 0;
int a[maxn];
int head[maxn], des[maxn << 1], nxt[maxn << 1];
int f[maxn][5005];
void adde(int x, int y) {
  des[++tot] = y;
  nxt[tot] = head[x];
  head[x] = tot;
}
int dfs(int x, int fa) {
  int leaf = 1;
  for (int(i) = (0); (i) <= (5000); (i)++) f[x][i] = inf;
  for (int(p) = head[(x)]; (p); (p) = nxt[(p)])
    if (des[p] != fa) {
      int num = dfs(des[p], x);
      if (num == inf) return inf;
      if (leaf) {
        f[x][num] = a[des[p]];
        f[x][a[des[p]]] = num;
      } else {
        for (int(i) = (5000); (i) >= (0); (i)--) {
          if (i >= a[des[p]]) f[x][i] = min(f[x][i], f[x][i - a[des[p]]] + num);
          if (i >= num) f[x][i] = min(f[x][i], f[x][i - num] + a[des[p]]);
        }
      }
      leaf = 0;
    }
  int res = inf;
  for (int(i) = (0); (i) <= (a[x]); (i)++) res = min(res, f[x][i]);
  if (leaf) return 0;
  if (res == inf) flag = 1;
  return res;
}
int main() {
  read(n);
  for (int(i) = (2); (i) <= (n); (i)++) {
    int x;
    read(x);
    adde(x, i);
  }
  for (int(i) = (1); (i) <= (n); (i)++) read(a[i]);
  dfs(1, 0);
  if (flag)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
