#include <bits/stdc++.h>
using std::vector;
const int MAXN = 1005;
int n;
int he[MAXN], fa[MAXN], w[MAXN], sum0[MAXN], sum1[MAXN], sum[MAXN];
char col[MAXN];
vector<int> tmp;
struct line {
  int to, nex;
  line(int to = 0, int nex = 0) : to(to), nex(nex){};
} ed[MAXN];
inline void addE(int u, int v) {
  static int cnt = 0;
  ed[++cnt] = line(v, he[u]);
  he[u] = cnt;
}
inline bool jud(int u) {
  static bool can[MAXN];
  memset(can, false, sizeof(can));
  for (int i = 0; i < tmp.size(); ++i) {
    if (tmp[i] <= w[u]) can[tmp[i]] = true;
  }
  for (int i = 0; i < tmp.size(); ++i) {
    for (int j = w[u]; j >= tmp[i]; --j) can[j] |= can[j - tmp[i]];
  }
  return can[w[u]];
}
bool DP(int u) {
  tmp.clear();
  for (int i = he[u], v; i; i = ed[i].nex) {
    v = ed[i].to;
    tmp.push_back(w[v]);
  }
  if (!jud(u)) return false;
  for (int i = he[u], v; i; i = ed[i].nex) {
    if (!DP(ed[i].to)) return false;
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) {
    scanf("%d", &fa[i]);
    addE(fa[i], i);
  }
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  memset(col, -1, sizeof(col));
  if (DP(1))
    printf("POSSIBLE");
  else
    printf("IMPOSSIBLE");
  return 0;
}
