#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 1;
const long long MOD = 1e9 + 7;
const long double PI = 3.14159265358979323846264338;
long long fast_ex(long long a, long long n, long long m) {
  if (n == 0) return 1;
  if (n == 1) return a;
  long long x = 1;
  x *= fast_ex(a, n / 2, m);
  x %= m;
  x *= x;
  x %= m;
  if (n % 2) x *= a;
  x %= m;
  return x;
}
const long long N = 1001;
long long a[N];
vector<long long> adj[N];
long long black[N];
long long white[N];
long long n;
long long db[5 * N];
long long dw[5 * N];
void dfs(long long u) {
  if (adj[u].size() == 0) {
    black[u] = white[u] = 0;
    return;
  }
  for (long long v : adj[u]) {
    dfs(v);
  }
  for (long long i = 0; i < 5 * N; i++) db[i] = dw[i] = INF;
  db[0] = 0;
  dw[0] = 0;
  for (long long v : adj[u]) {
    if (!a[v])
      db[0] += min(black[v], a[v]);
    else
      db[0] += a[v];
    if (!a[v])
      dw[0] += min(white[v], a[v]);
    else
      dw[0] += a[v];
  }
  for (long long v : adj[u]) {
    for (long long i = 1; i <= a[u]; i++) {
      if (white[v] <= i) db[i] = min(db[i], db[i - white[v]] + a[v]);
      if (a[v] <= i) db[i] = min(db[i], db[i - a[v]] + black[v]);
      if (black[v] <= i) dw[i] = min(dw[i], dw[i - black[v]] + a[v]);
      if (a[v] <= i) dw[i] = min(dw[i], dw[i - a[v]] + white[v]);
    }
  }
  for (long long i = 1; i <= a[u]; i++) {
    black[u] = min(db[i], black[u]);
    white[u] = min(dw[i], white[u]);
  }
  if (!a[u]) {
    black[u] = db[0];
    white[u] = dw[0];
  }
}
void solve() {
  cin >> n;
  for (long long i = 2; i <= n; i++) {
    long long j;
    cin >> j;
    adj[j].push_back(i);
  }
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    black[i] = white[i] = INF;
  }
  dfs(1);
  if (black[1] != INF or white[1] != INF)
    cout << "POSSIBLE";
  else
    cout << "IMPOSSIBLE";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
