#include <bits/stdc++.h>
using namespace std;
int x[1001], n;
vector<int> child[1001];
int d[1001];
int f(int u) {
  if (d[u] >= 0) return d[u];
  if (child[u].empty()) return d[u] = 0;
  int dd[2][5001];
  dd[1][0] = 0;
  int from = 1, to = 0;
  for (int i = 0; i < child[u].size(); i++) {
    int w1 = f(child[u][i]), w2 = x[child[u][i]];
    for (int j = 0; j <= x[u]; j++) {
      dd[to][j] = (1 << 30);
      if (j >= w1 && dd[to][j] > dd[from][j - w1] + w2)
        dd[to][j] = dd[from][j - w1] + w2;
      if (j >= w2 && dd[to][j] > dd[from][j - w2] + w1)
        dd[to][j] = dd[from][j - w2] + w1;
    }
    from ^= 1;
    to ^= 1;
  }
  int ret = (1 << 30);
  for (int j = 0; j <= x[u]; j++)
    if (dd[from][j] < ret) ret = dd[from][j];
  return d[u] = ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int p;
    scanf("%d", &p);
    child[p].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  memset(d, -1, sizeof(d));
  if (f(1) == (1 << 30))
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
