#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 4010;
int n, x, f[N][2], g[2][M], v[N];
int tot, fi[N], a[N], ne[N];
inline void add(int x, int y) {
  a[++tot] = y;
  ne[tot] = fi[x];
  fi[x] = tot;
}
inline void update(int v, int wi1, int bl1, int wi2, int bl2) {
  int tmp;
  for (int i = v; ~i; --i) {
    tmp = 1e9;
    if (i >= wi1) tmp = min(tmp, g[0][i - wi1] + bl1);
    if (i >= wi2) tmp = min(tmp, g[0][i - wi2] + bl2);
    g[0][i] = tmp;
    tmp = 1e9;
    if (i >= bl1) tmp = min(tmp, g[1][i - bl1] + wi1);
    if (i >= bl2) tmp = min(tmp, g[1][i - bl2] + wi2);
    g[1][i] = tmp;
  }
}
inline void solve(int x) {
  for (int i = fi[x]; i; i = ne[i]) solve(a[i]);
  g[0][0] = g[1][0] = 0;
  for (int i = 1; i <= v[x]; ++i) g[0][i] = g[1][i] = 1e9;
  for (int i = fi[x]; i; i = ne[i])
    update(v[x], v[a[i]], f[a[i]][0], f[a[i]][1], v[a[i]]);
  f[x][0] = f[x][1] = 1e9;
  for (int i = 0; i <= v[x]; ++i)
    f[x][0] = min(f[x][0], g[0][i]), f[x][1] = min(f[x][1], g[1][i]);
  if (f[x][0] == 1e9 && f[x][1] == 1e9) exit(puts("IMPOSSIBLE") * 0);
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) scanf("%d", &x), add(x, i);
  for (int i = 1; i <= n; ++i) scanf("%d", v + i);
  solve(1);
  puts("POSSIBLE");
  return 0;
}
