#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10, inf = 0x3f3f3f3f;
int n, m, k, t, d[maxn], a[maxn], b[maxn];
vector<int> e[maxn];
void upd(int &x, int y) {
  if (x > y) x = y;
}
void dfs(int x) {
  for (auto y : e[x]) dfs(y);
  memset(d, 0, sizeof(d[0]) * (a[x] + 1));
  for (auto y : e[x]) {
    int tmp = inf;
    for (int i = a[x]; i >= 0; i--) {
      if (i >= a[y]) upd(tmp, d[i - a[y]] + b[y]);
      if (i >= b[y]) upd(tmp, d[i - b[y]] + a[y]);
      d[i] = tmp;
    }
  }
  b[x] = *min_element(d, d + a[x] + 1);
}
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 2; i <= n; i++) scanf("%d", &j), e[j].push_back(i);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  dfs(1);
  puts(b[1] < inf ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
