#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
bool ans, o, be[5001];
int l, ne[N], son[N], ed[N], fa[N], a[N], f[N][2], x, n, w;
void dfs(int x) {
  int l = son[x], y;
  while (l > 0) {
    y = ed[l];
    if (x == fa[y]) dfs(y);
    if (ans) return;
    l = ne[l];
  }
  l = son[x];
  w = 0;
  memset(be, 0, sizeof(be));
  while (l > 0) {
    y = ed[l];
    if (x == fa[y]) {
      w += f[y][0] + f[y][1];
      for (int i = 5000; i >= 0; i--) {
        if ((i - f[y][0] > 0 && be[i - f[y][0]]) || i - f[y][0] == 0) be[i] = 1;
        if ((i - f[y][1] > 0 && be[i - f[y][1]]) || i - f[y][1] == 0) be[i] = 1;
      }
    }
    l = ne[l];
  }
  o = 0;
  for (int i = a[x]; i >= 0; i--)
    if (be[i]) {
      o = 1;
      f[x][0] = a[x];
      f[x][1] = w - i;
      break;
    }
  if (w == 0) {
    o = 1;
    f[x][0] = a[x];
    f[x][1] = 0;
  }
  if (!o) {
    ans = 1;
    printf("IMPOSSIBLE");
    return;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = (2); i < (n + 1); i++) {
    scanf("%d", &x);
    fa[i] = x;
    l++;
    ne[l] = son[x];
    son[x] = l;
    ed[l] = i;
    l++;
    ne[l] = son[i];
    son[i] = l;
    ed[l] = x;
  }
  for (int i = (1); i < (n + 1); i++) scanf("%d", &a[i]);
  dfs(1);
  if (!ans) printf("POSSIBLE");
}
