#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int n, x[1005], a, b;
vector<int> ch[200005];
P dfs(int t) {
  int s = 0;
  bool ok[5005] = {true};
  for (int c : ch[t]) {
    tie(a, b) = dfs(c);
    bool tp[10005] = {};
    for (int i = 0; i < (5001); i++) {
      if (ok[i]) tp[i + a] = tp[i + b] = true;
      ok[i] = tp[i];
    }
    s += a + b;
  }
  for (int i = x[t]; i >= 0; i--)
    if (ok[i]) return P(s - i, x[t]);
  puts("IMPOSSIBLE");
  exit(0);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n - 1); i++) {
    scanf("%d", &a);
    ch[a - 1].push_back(i + 1);
  }
  for (int i = 0; i < (n); i++) scanf("%d", x + i);
  dfs(0);
  puts("POSSIBLE");
}
