#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(228);
const int N = 1e3 + 7;
const int M = 5e3 + 7;
int a[N], b[N];
int cur[N][M];
int sz[N];
int w[N];
int mx[N];
vector<int> g[N];
void dfs(int v) {
  if (g[v].size() == 0) {
    a[v] = 0;
    b[v] = w[v];
    return;
  }
  for (int to : g[v]) {
    dfs(to);
  }
  int i = 0;
  cur[0][0] = 0;
  for (int to : g[v]) {
    for (int x = 0; x < M; x++) {
      if (x + w[to] < M) {
        cur[i + 1][x + w[to]] = min(cur[i + 1][x + w[to]], cur[i][x] + a[to]);
      }
      if (x + b[to] < M) {
        cur[i + 1][x + b[to]] = min(cur[i + 1][x + b[to]], cur[i][x] + w[to]);
      }
      cur[i][x] = 1e9;
    }
    i++;
  }
  a[v] = 1e9, b[v] = 1e9;
  for (int x = 0; x < M; x++) {
    if (x <= w[v]) {
      a[v] = min(a[v], cur[i][x]);
    }
    if (cur[i][x] <= w[v]) {
      b[v] = min(b[v], x);
    }
    cur[i][x] = 1e9;
  }
  if (a[v] == 1e9 && b[v] == 1e9) {
    cout << "IMPOSSIBLE\n";
    exit(0);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int p;
    scanf("%d", &p);
    p--;
    g[p].push_back(i);
  }
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) cur[i][j] = 1e9;
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i]);
  }
  dfs(0);
  cout << "POSSIBLE\n";
}
