#include <bits/stdc++.h>
using namespace std;
const int N = 1001;
const int inf = int(1e9);
int n, x[N], p, g[N];
vector<int> a[N];
void DFS(int u) {
  if (a[u].empty()) return;
  vector<int> f(x[u] + 1, inf);
  bool first = 1, cando;
  for (int v : a[u]) {
    DFS(v);
    if (first) {
      cando = first = 0;
      if (g[v] <= x[u]) f[g[v]] = x[v], cando = 1;
      if (x[v] <= x[u]) f[x[v]] = g[v], cando = 1;
    } else {
      cando = 0;
      for (int i = 0; i <= x[u]; ++i) {
        if (f[i] == inf) continue;
        if (i + x[v] <= x[u]) {
          f[i + x[v]] = min(f[i + x[v]], f[i] + g[v]);
          cando = 1;
        }
        if (i + g[v] <= x[u]) {
          f[i + g[v]] = min(f[i + g[v]], f[i] + x[v]);
          cando = 1;
        }
      }
    }
    if (!cando) {
      cout << "IMPOSSIBLE";
      exit(0);
    }
  }
  g[u] = inf;
  for (int i = 0; i <= x[u]; ++i) g[u] = min(g[u], f[i]);
  if (g[u] == inf) {
    cout << "IMPOSSIBLE";
    exit(0);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  if (fopen("test"
            ".inp",
            "r")) {
    freopen(
        "test"
        ".inp",
        "r", stdin);
    freopen(
        "test"
        ".out",
        "w", stdout);
  }
  cin >> n;
  for (int i = 2; i <= n; ++i) cin >> p, a[p].emplace_back(i);
  for (int i = 1; i <= n; ++i) cin >> x[i];
  DFS(1);
  cout << "POSSIBLE";
}
