#include <bits/stdc++.h>
const int dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, -1, 1};
const int N = 5005;
const long long inf = 1ll << 60;
int n, now = 0, head[N], sum[N];
int f[N], dp[1005][N];
using namespace std;
struct node {
  int t, next;
} adj[N << 1];
void add(int s, int t) {
  adj[++now] = (node){t, head[s]};
  head[s] = now;
}
inline int read() {
  char c;
  int x;
  while (c = getchar(), c < '0' || c > '9')
    ;
  x = c ^ '0';
  while (c = getchar(), c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ '0');
  return x;
}
void write(int x) {
  if (x == 0) return;
  write(x / 10);
  putchar((x % 10) + '0');
}
void upd(int& x, int y) {
  if (x == -1)
    x = y;
  else
    x = max(x, y);
}
void clear(int i) { memset(dp[i], 0, sizeof(dp[i])); }
void dfs(int s, int fa) {
  int i, ok = 1, j;
  for (i = head[s]; i; i = adj[i].next)
    if (adj[i].t != fa) ok = 0, dfs(adj[i].t, s);
  if (ok) {
    f[s] = sum[s];
    return;
  }
  int p = 0;
  clear(0);
  dp[0][0] = 1;
  for (i = head[s]; i; i = adj[i].next)
    if (adj[i].t != fa) {
      p++;
      clear(p);
      for (j = 0; j <= sum[s]; j++) {
        if (j >= f[adj[i].t]) dp[p][j] |= dp[p - 1][j - f[adj[i].t]];
        if (j >= (f[adj[i].t] - sum[adj[i].t]))
          dp[p][j] |= dp[p - 1][j - (f[adj[i].t] - sum[adj[i].t])];
      }
      f[s] += f[adj[i].t];
    }
  for (j = sum[s]; j >= 0; j--)
    if (dp[p][j]) break;
  if (j < 0) {
    puts("IMPOSSIBLE");
    exit(0);
  }
  f[s] += sum[s] - j;
}
int main() {
  scanf("%d", &n);
  int i, fa;
  for (i = 2; i <= n; i++) cin >> fa, add(i, fa), add(fa, i);
  for (i = 1; i <= n; i++) cin >> sum[i];
  dfs(1, 0);
  printf("POSSIBLE");
  return 0;
}
