#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
struct data {
  int obj, pre;
} e[1005];
int head[1005], f[1005], now[5005], g[1005][5005], a[1005];
int n, tot;
void insert(int x, int y) {
  e[++tot].obj = y;
  e[tot].pre = head[x];
  head[x] = tot;
}
void dfs(int u) {
  for (int i = 0; i <= 5000; i++) g[u][i] = 2e9;
  g[u][0] = 0;
  for (int j = head[u]; j; j = e[j].pre) {
    int v = e[j].obj;
    dfs(v);
    for (int i = 0; i <= 5000; i++) now[i] = 2e9;
    for (int i = a[v]; i <= a[u]; i++)
      now[i] = min(now[i], g[u][i - a[v]] + f[v]);
    for (int i = f[v]; i <= a[u]; i++)
      now[i] = min(now[i], g[u][i - f[v]] + a[v]);
    for (int i = 0; i <= a[u]; i++) g[u][i] = now[i];
  }
  f[u] = 2e9;
  for (int i = 0; i <= a[u]; i++) f[u] = min(f[u], g[u][i]);
}
int main() {
  n = read();
  for (int i = 2; i <= n; i++) {
    int x = read();
    insert(x, i);
  }
  for (int i = 1; i <= n; i++) a[i] = read();
  dfs(1);
  if (f[1] == 2e9)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
