#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n;
int x[N];
vector<int> nb[N];
int max_x[N];
int in[N];
void DFS_Bigger(int v) {
  max_x[v] = x[v];
  for (int i = 0; i < nb[v].size(); i++) {
    DFS_Bigger(nb[v][i]);
    max_x[v] = max(max_x[v], max_x[nb[v][i]]);
  }
}
int checking;
bool cool;
void DFS_Check(int v) {
  if (x[v] > x[checking] && max_x[v] > x[v]) cool = false;
  if (x[v] > x[checking] && in[v] > x[checking]) cool = false;
  for (int i = 0; i < nb[v].size(); i++) {
    DFS_Check(nb[v][i]);
  }
}
bool used[5000 * N];
int calc_in(int v) {
  vector<int> c;
  int i, j, sz;
  int sum = 0;
  for (i = 0; i < nb[v].size(); i++) sum += x[nb[v][i]];
  memset(used, false, sizeof(used));
  used[0] = true;
  c.push_back(0);
  for (i = 0; i < nb[v].size(); i++) {
    sz = c.size();
    for (j = 0; j < sz; j++) {
      if (!used[x[nb[v][i]] + c[j]]) {
        c.push_back(x[nb[v][i]] + c[j]);
        used[x[nb[v][i]] + c[j]] = true;
      }
    }
  }
  for (i = x[v]; i >= 0; i--) {
    if (used[i]) return sum - i;
  }
}
int main() {
  int i;
  int p;
  cin >> n;
  for (i = 2; i <= n; i++) {
    scanf("%d", &p);
    nb[p].push_back(i);
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &x[i]);
  }
  for (i = 1; i <= n; i++) {
    DFS_Bigger(i);
    in[i] = calc_in(i);
  }
  for (i = 1; i <= n; i++) {
    checking = i;
    cool = true;
    DFS_Check(i);
    if (!cool) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
  }
  printf("POSSIBLE\n");
  return 0;
}
