#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int n, x[maxn], fa[maxn];
long long all[maxn];
bitset<5010> f[maxn];
bool chk[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &fa[i]), chk[fa[i]] = 1;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x[i]), f[i].set(0);
  }
  for (int i = n; i; i--) {
    if (chk[i]) {
      int t = -1;
      for (int j = 0; j <= 5000; j++) {
        if (f[i].test(j) && all[i] - j <= x[i]) {
          t = j;
          break;
        }
      }
      if (!~t) printf("IMPOSSIBLE\n"), exit(0);
      f[fa[i]] |= (f[fa[i]] << x[i]);
      all[fa[i]] += t + x[i];
    } else {
      f[fa[i]] |= (f[fa[i]] << x[i]);
      all[fa[i]] += x[i];
    }
  }
  printf("POSSIBLE\n");
  return 0;
}
