#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 11, INF = ~0u >> 2;
struct Edge {
  int nxt, to;
} edge[N];
int f[N], g[N], a[N], head[N], num_edge, n;
void add_edge(int from, int to) {
  edge[++num_edge].nxt = head[from];
  edge[num_edge].to = to;
  head[from] = num_edge;
}
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
void dfs(int u) {
  for (int i = head[u]; i; i = edge[i].nxt) dfs(edge[i].to);
  g[0] = 0;
  for (int i = 1; i <= (a[u]); i++) g[i] = INF;
  for (int i = head[u]; i; i = edge[i].nxt) {
    int v = edge[i].to;
    for (int j = (0); j <= (a[u]); j++) g[j] = INF;
    for (int j = (0); j <= (a[u] - a[v]); j++)
      g[j + a[v]] = min(g[j + a[v]], g[j] + f[v]);
    for (int j = (0); j <= (a[u] - f[v]); j++)
      g[j + f[v]] = min(g[j + f[v]], g[j] + a[v]);
  }
  f[u] = INF;
  for (int i = (0); i <= (a[u]); i++) f[u] = min(f[u], g[i]);
}
int main() {
  n = read();
  for (int i = (2); i <= (n); i++) {
    int tmp = read();
    add_edge(tmp, i);
  }
  for (int i = 1; i <= (n); i++) a[i] = read();
  dfs(1);
  for (int i = 1; i <= (n); i++)
    if (f[i] == INF) {
      puts("IMPOSSIBLE");
      return 0;
    }
  puts("POSSIBLE");
  return 0;
}
