#include <bits/stdc++.h>
using namespace std;
int n;
int head[10005], ver[10005], nxt[10005], tot, v[10005];
void add(int a, int b) {
  tot++;
  nxt[tot] = head[a];
  head[a] = tot;
  ver[tot] = b;
  return;
}
int f[10005], flag;
int now[1005][5005];
void dfs(int x) {
  now[x][0] = 1;
  int sum = 0;
  for (int i = head[x]; i; i = nxt[i]) {
    dfs(ver[i]);
    int a = min(f[ver[i]], v[ver[i]]), b = max(f[ver[i]], v[ver[i]]);
    for (int j = v[x]; j >= a; j--) {
      if (b > j)
        now[x][j] = now[x][j - a] + b;
      else
        now[x][j] = min(now[x][j - a] + b, now[x][j - b] + a);
    }
    for (int j = 0; j < a; j++) now[x][j] = 0x3f3f3f3f;
  }
  f[x] = now[x][0];
  for (int j = 0; j <= v[x]; j++) f[x] = min(f[x], now[x][j]);
  if (f[x] >= 0x3f3f3f3f) {
    puts("IMPOSSIBLE");
    exit(0);
  }
  return;
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int tmp;
    cin >> tmp;
    add(tmp, i);
  }
  for (int i = 1; i <= n; i++) cin >> v[i];
  dfs(1);
  puts("POSSIBLE");
  return 0;
}
