#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][10005];
void dfs(int x) {
  now[x][0] = 1;
  int sum = 0;
  for (int i = head[x]; i; i = nxt[i]) {
    dfs(ver[i]);
    sum += f[ver[i]] + v[ver[i]];
    for (int j = 10000; j >= 0; j--) {
      if (now[x][j]) {
        now[x][j] = 0;
        now[x][j + f[ver[i]]] = 1;
        now[x][j + v[ver[i]]] = 1;
      }
    }
  }
  f[x] = 0x3f3f3f3f;
  for (int j = 10000; j >= 0; j--)
    if (now[x][j] && sum - j <= v[x]) f[x] = j;
  if (f[x] == 0x3f3f3f3f) {
    f[x] = 0;
    flag = 1;
  }
  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);
  if (flag)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
