#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e+9) + 7;
const long long INF = (long long)1000000007 * 1000000007;
const long double eps = 1e-12;
const long double pi = acos(-1.0);
int d[1000][2];
vector<int> G[1000];
int a[1000];
int dpb[5001], dpw[5001];
void dfs(int id) {
  int len = G[id].size();
  fill(dpb, dpb + a[id] + 1, (int)mod);
  dpb[0] = 0;
  fill(dpw, dpw + a[id] + 1, (int)mod);
  dpw[0] = 0;
  for (int i = 0; i < len; i++) {
    int v = G[id][i];
    dfs(v);
    for (int j = a[id] + 1 - 1; j >= 0; j--) {
      if (dpb[j] == (int)mod) continue;
      if (j + a[v] <= a[id])
        dpb[j + a[v]] = min(dpb[j + a[v]], dpb[j] + d[v][0]);
      if (j + d[v][1] <= a[id])
        dpb[j + d[v][1]] = min(dpb[j + d[v][1]], dpb[j] + a[v]);
      dpb[j] = (int)mod;
    }
    for (int j = a[id] + 1 - 1; j >= 0; j--) {
      if (dpw[j] == (int)mod) continue;
      if (j + a[v] <= a[id])
        dpw[j + a[v]] = min(dpw[j + a[v]], dpw[j] + d[v][1]);
      if (j + d[v][0] <= a[id])
        dpw[j + d[v][1]] = min(dpw[j + d[v][1]], dpw[j] + a[v]);
      dpw[j] = (int)mod;
    }
  }
  int mib = (int)mod;
  int miw = (int)mod;
  for (int i = a[id] + 1 - 1; i >= 0; i--) {
    mib = min(mib, dpb[i]);
    miw = min(miw, dpw[i]);
  }
  d[id][0] = mib;
  d[id][1] = miw;
  return;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int p;
    cin >> p;
    p--;
    G[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dfs(0);
  if (d[0][0] < (int)mod && d[0][1] < (int)mod)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
