#include <bits/stdc++.h>
using namespace std;
extern inline char gc() {
  static char RR[23456], *S = RR + 23333, *T = RR + 23333;
  if (S == T) fread(RR, 1, 23333, stdin), S = RR;
  return *S++;
}
inline int read() {
  int p = 0, w = 1;
  char c = gc();
  while (c > '9' || c < '0') {
    if (c == '-') w = -1;
    c = gc();
  }
  while (c >= '0' && c <= '9') p = p * 10 + c - '0', c = gc();
  return p * w;
}
int n;
int fa[1005], w[1005], v[1005], f[2][1005];
vector<int> son[1005];
inline void cmin(int &a, int b) {
  if (a > b) a = b;
}
inline void dfs(int o) {
  for (int i = 0; i < son[o].size(); i++) dfs(son[o][i]);
  memset(f, 127, sizeof(f));
  int now = 1, pre = 0;
  f[now][0] = 0;
  for (register int i = 0; i < son[o].size(); i++) {
    int cur = son[o][i];
    now ^= 1;
    pre ^= 1;
    memset(f[now], 127, sizeof(f[now]));
    for (register int j = 0; j <= w[o]; j++) {
      if (j >= w[cur]) cmin(f[now][j], f[pre][j - w[cur]] + v[cur]);
      if (j >= v[cur]) cmin(f[now][j], f[pre][j - v[cur]] + w[cur]);
    }
  }
  v[o] = 1e9;
  for (register int i = 0; i <= w[o]; i++) cmin(v[o], f[now][i]);
}
int main() {
  n = read();
  for (register int i = 2; i <= n; i++) son[read()].push_back(i);
  for (register int i = 1; i <= n; i++) w[i] = read();
  dfs(1);
  if (v[1] < 1e9)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
