#include <bits/stdc++.h>
using namespace std;
int n, fa[5005], fl[5005], ft[5005], a[5005], b[5005];
vector<int> e[5005];
void biu() {
  puts("IMPOSSIBLE");
  exit(0);
}
void dfs(int x) {
  memset(fl, 0, sizeof fl);
  fl[0] = 1;
  int sum = 0;
  for (int i = 0; i < e[x].size(); i++) {
    dfs(e[x][i]);
    sum += a[e[x][i]] + b[e[x][i]];
    memset(ft, 0, sizeof ft);
    for (int j = 0; j <= a[x]; j++)
      ft[j] = (j >= a[e[x][i]] && fl[j - a[e[x][i]]]) ||
              (j >= b[e[x][i]] && fl[j - b[e[x][i]]]);
    memcpy(fl, ft, sizeof fl);
  }
  int now = a[x];
  for (; now >= 0 && !fl[now]; now--)
    ;
  if (now == -1) biu();
  sum -= now;
  b[x] = sum;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &fa[i]);
    e[fa[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dfs(1);
  puts("POSSIBLE");
}
