#include <bits/stdc++.h>
using namespace std;
int head[1002], ver[1002 * 2], nxt[1002 * 2], l;
int n, i, a[1002], sum[1002], f[1002][5002];
int read() {
  char c = getchar();
  int w = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c <= '9' && c >= '0') {
    w = w * 10 + c - '0';
    c = getchar();
  }
  return w;
}
void insert(int x, int y) {
  l++;
  ver[l] = y;
  nxt[l] = head[x];
  head[x] = l;
}
void dfs(int x, int pre) {
  sum[x] = x;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    dfs(y, x);
    sum[x] += sum[y];
  }
  f[x][x] = 1;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (y != pre) {
      for (int j = a[x]; j >= x; j--) {
        if (j + a[y] <= a[x]) f[x][j + a[y]] |= f[x][j];
        if (j + sum[y] - a[y] <= a[x]) f[x][j + sum[y] - a[y]] |= f[x][j];
      }
    }
  }
}
int main() {
  n = read();
  for (i = 2; i <= n; i++) {
    int u = read();
    insert(u, i);
  }
  for (i = 1; i <= n; i++) a[i] = read();
  dfs(1, 0);
  bool ans = 1;
  for (i = 1; i <= n; i++) ans &= f[i][a[i]];
  if (ans)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
