#include <bits/stdc++.h>
int n;
int p[1005];
std::vector<int> down[1005];
int want[1005];
int other[1005];
bool bad = 0;
int min1[5005];
int min2[5005];
void dfs(int u) {
  memset(min1, 0x3f, sizeof min1);
  min1[0] = 0;
  for (int v : down[u]) {
    dfs(v);
    memset(min2, 0x3f, sizeof min2);
    for (int i = want[v]; i <= want[u]; i++) {
      min2[i] = (min2[i] <= min1[i - want[v]] + other[v]
                     ? min2[i]
                     : min1[i - want[v]] + other[v]);
    }
    for (int i = other[v]; i <= want[u]; i++) {
      min2[i] = (min2[i] <= min1[i - other[v]] + want[v]
                     ? min2[i]
                     : min1[i - other[v]] + want[v]);
    }
    for (int i = 0; i <= want[u]; i++) min1[i] = min2[i];
  }
  for (int i = 0; i <= want[u]; i++) {
    other[u] = (other[u] <= min1[i] ? other[u] : min1[i]);
  }
  if (other[u] == 0x3f3f3f3f) bad = 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", p + i);
    down[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", want + i);
  }
  memset(other, 0x3f, sizeof other);
  dfs(1);
  if (bad) printf("IM");
  printf("POSSIBLE\n");
}
