#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 7;
int n, size[N], w[N], f[N][N], box[N];
int lst[N], nxt[N], to[N], tot;
void add(int x, int y) {
  nxt[++tot] = lst[x];
  to[tot] = y;
  lst[x] = tot;
}
void init() {
  cin >> n;
  int fa;
  for (int i = 2; i <= n; i++) {
    scanf("%d", &fa);
    add(fa, i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
}
bool run(int u) {
  int sum = 0, cnt = 0;
  for (int i = lst[u]; i; i = nxt[i]) {
    int v = to[i];
    if (!run(v)) return 0;
    size[u] += size[v];
    sum += min(w[v], size[v] - w[v]);
    box[++cnt] = (size[v] - sum) - sum;
  }
  if (sum > w[u]) {
    return 0;
  }
  sum = w[u] - sum;
  int maxn = 0;
  sort(box + 1, box + 1 + cnt);
  memset(f, 0, sizeof(f));
  priority_queue<int> h[cnt + 7];
  for (int i = 1; i <= cnt; i++) {
    if (box[i] > sum) break;
    for (int j = i; j >= 1; j--) {
      int tmp = 0;
      if (!h[j - 1].empty()) tmp = h[j - 1].top();
      while (!h[j - 1].empty() && tmp + box[i] > sum) {
        h[j - 1].pop();
        tmp = h[j - 1].top();
      }
      f[i][j] = tmp + box[i];
      h[j].push(f[i][j]);
      maxn = max(maxn, f[i][j]);
    }
  }
  size[u] += sum - maxn;
  return 1;
}
int main() {
  init();
  if (run(1))
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
