#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int INF = 1000000000;
int n, a[1010], f[1010];
int head[MAXN], to[MAXN], next2[MAXN], cnt = 1;
inline void adde(int f, int t) {
  cnt++, to[cnt] = t, next2[cnt] = head[f], head[f] = cnt;
  cnt++, to[cnt] = f, next2[cnt] = head[t], head[t] = cnt;
}
int g[1010][5010];
void DFS(int x, int fa) {
  vector<int> v;
  for (int i = head[x]; i; i = next2[i])
    if (to[i] != fa) DFS(to[i], x), v.push_back(to[i]);
  int ch = v.size();
  if (!ch) {
    f[x] = 0;
    return;
  }
  for (int i = 0; i <= ch; i++)
    for (int j = 0; j <= a[x]; j++) g[i][j] = INF;
  f[x] = INF;
  g[0][0] = 0;
  for (int i = 1; i <= ch; i++) {
    int o = v[i - 1];
    for (int j = a[o]; j <= a[x]; j++)
      g[i][j] = min(g[i][j], g[i - 1][j - a[o]] + f[o]);
    for (int j = 1; j <= a[x]; j++)
      g[i - 1][j] = min(g[i - 1][j - 1], g[i - 1][j]);
    for (int j = f[o]; j <= a[x]; j++)
      g[i][j] = min(g[i][j], g[i - 1][j - f[o]] + a[o]);
  }
  f[x] = min(f[x], g[ch][a[x]]);
}
int main() {
  scanf("%d", &n);
  for (int i = 2, x; i <= n; i++) scanf("%d", &x), adde(i, x);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  DFS(1, -1);
  if (f[1] == INF)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
