#include <bits/stdc++.h>
namespace std {
int min(int x, int y) { return x < y ? x : y; }
int max(int x, int y) { return x > y ? x : y; }
}  // namespace std
const int N(1010), M(5010);
struct edge {
  int next, to;
} e[N];
int n, X[N], f[N], g[N], head[N], max, e_num;
inline void add_edge(int from, int to) {
  e[++e_num] = (edge){head[from], to};
  head[from] = e_num;
}
void dfs(int x) {
  for (int i = head[x]; i; i = e[i].next) dfs(e[i].to);
  memset(g, 0x3f, (X[x] + 1) << 2), g[0] = 0;
  for (int i = head[x]; i; i = e[i].next) {
    int to = e[i].to;
    for (int j = X[x]; ~j; j--) {
      int t = 0x3f3f3f3f;
      if (j >= X[to]) t = std::min(t, g[j - X[to]] + f[to]);
      if (j >= f[to]) t = std::min(t, g[j - f[to]] + X[to]);
      g[j] = t;
    }
  }
  for (int i = 0; i <= X[x]; i++) f[x] = std::min(f[x], g[i]);
}
int main() {
  scanf("%d", &n), memset(f, 0x3f, sizeof f);
  for (int i = 2, x; i <= n; i++) scanf("%d", &x), add_edge(x, i);
  for (int i = 1; i <= n; i++) scanf("%d", X + i), max = std::max(max, X[i]);
  dfs(1);
  puts(f[1] == 0x3f3f3f3f ? "IMPOSSIBLE" : "POSSIBLE");
  return 0;
}
