#include <bits/stdc++.h>
using namespace std;
int n, W[6000], f[2][6000], g[6000];
int read() {
  int x = 0, k = 1;
  char c;
  c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') k = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * k;
}
struct edge {
  int cnp, to[6000], last[6000], head[6000];
  edge() { cnp = 2; }
  void add(int u, int v) { to[cnp] = v, last[cnp] = head[u], head[u] = cnp++; }
} E1;
bool Down(int &x, int y) {
  if (y >= 999999999) return 0;
  x = min(x, y);
  return 1;
}
void dfs(int u) {
  for (int i = E1.head[u]; i; i = E1.last[i]) {
    int v = E1.to[i];
    dfs(v);
  }
  for (int i = 0; i <= W[u]; i++) f[0][i] = 999999999;
  f[0][0] = f[0][0] = 0;
  int pre = 0, now = 1;
  for (int i = E1.head[u]; i; i = E1.last[i]) {
    int v = E1.to[i];
    for (int j = 0; j <= 1; j++)
      for (int k = 0; k <= W[u]; k++) f[now][j] = 999999999;
    for (int j = 0; j <= W[u]; j++) {
      int flag = 0;
      if (j - W[v] >= 0) flag = Down(f[now][j], f[pre][j - W[v]] + g[v]);
      if (j - g[v] >= 0) flag = Down(f[now][j], f[pre][j - g[v]] + W[v]);
    }
    swap(pre, now);
  }
  g[u] = 999999999;
  for (int j = 0; j <= W[u]; j++) g[u] = min(g[u], f[pre][j]);
}
int main() {
  n = read();
  for (int i = 2; i <= n; i++) {
    int x = read();
    E1.add(x, i);
  }
  for (int i = 1; i <= n; i++) W[i] = read();
  dfs(1);
  if (g[1] < 999999999)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
