#include <bits/stdc++.h>
using namespace std;
int n, fa[1010], a[1010], fir[1010], nxt[1010 << 1], to[1010 << 1],
    tot(1), f[1010][2], g[2][5010 * 10], fl(0);
inline void add(int u, int v) {
  to[++tot] = v;
  nxt[tot] = fir[u];
  fir[u] = tot;
}
void dfs(int x) {
  int cur = 0, s = 0, mx = -1;
  g[0][0] = 1;
  for (int i = fir[x]; i; i = nxt[i])
    if (to[i] != fa[x]) {
      dfs(to[i]);
      if (fl) return;
      cur ^= 1;
      for (int j = 0; j <= a[x]; j++) g[cur][j] = 0;
      for (int j = 0; j <= a[x]; j++)
        g[cur][j + f[to[i]][0]] |= g[cur ^ 1][j],
            g[cur][j + f[to[i]][1]] |= g[cur ^ 1][j];
      s += f[to[i]][0] + f[to[i]][1];
    }
  for (int i = a[x]; i >= 0 && !~mx; i--)
    if (g[cur][i]) mx = i;
  if (!~mx) {
    fl = 1;
    return;
  }
  f[x][0] = a[x];
  f[x][1] = s - mx;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &fa[i]);
    add(i, fa[i]), add(fa[i], i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dfs(1);
  if (fl)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
