#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e5;
long long int mpow(long long int a, long long int b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0) {
    long long int memo = mpow(a, b / 2);
    return memo * memo % (long long int)(1e9 + 7);
  } else
    return mpow(a, b - 1) * a % (long long int)(1e9 + 7);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
vector<long long int> kaijo_memo;
long long int kaijo(long long int n) {
  if (kaijo_memo.size() > n) return kaijo_memo[n];
  if (kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while (kaijo_memo.size() <= n)
    kaijo_memo.push_back(kaijo_memo[kaijo_memo.size() - 1] * kaijo_memo.size() %
                         (long long int)(1e9 + 7));
  return kaijo_memo[n];
}
long long int nCr(long long int n, long long int r) {
  if (n < r || r < 0) return 0;
  long long int ret = 1;
  ret *= kaijo(n);
  ret %= (long long int)(1e9 + 7);
  ret *= mpow(kaijo(r), (long long int)(1e9 + 7) - 2);
  ret %= (long long int)(1e9 + 7);
  ret *= mpow(kaijo(n - r), (long long int)(1e9 + 7) - 2);
  ret %= (long long int)(1e9 + 7);
  return ret;
}
long long int n;
vector<int> G[N];
vector<long long int> X;
bool can;
long long int saiki(int now) {
  if (G[now].size() == 0) {
    return 0;
  }
  vector<long long int> x;
  vector<long long int> kouho;
  bool hamidasi = false;
  for (int i = 0; i < (int)(G[now].size()); i++) {
    int next = G[now][i];
    kouho.push_back(saiki(next));
    x.push_back(X[next]);
    if (kouho[i] == 5001) hamidasi = true;
  }
  vector<bool> dp;
  for (int i = 0; i < (int)(5002); i++) {
    dp.push_back(false);
  }
  dp[0] = true;
  long long int sum = 0;
  for (int i = 0; i < (int)(kouho.size()); i++) {
    sum += kouho[i];
    sum += x[i];
    vector<bool> dp2;
    for (int j = 0; j < (int)(5002); j++) {
      dp2.push_back(false);
    }
    for (int j = 0; j < (int)(5002); j++) {
      if (dp[j]) {
        if (j + x[i] < 5002) {
          dp2[j + x[i]] = true;
        } else {
          dp2[5001] = true;
        }
        if (kouho[i] == 5001) continue;
        if (j + kouho[i] < 5002) {
          dp2[j + kouho[i]] = true;
        } else {
          dp2[5001] = true;
        }
      }
    }
    dp = dp2;
  }
  for (int i = 0; i < (int)(dp.size() - 1); i++) {
    if (sum - i <= X[now] && dp[i]) {
      return i;
    }
  }
  if (dp[5001] && !hamidasi) {
    return 5001;
  }
  cerr << now << " " << dp[2] << endl;
  can = false;
  return 0;
}
int main(void) {
  cin >> n;
  for (int i = 1; i <= (int)(n - 1); i++) {
    int p;
    cin >> p;
    p--;
    G[p].push_back(i);
  }
  for (int i = 0; i < (int)(n); i++) {
    long long int x;
    cin >> x;
    X.push_back(x);
  }
  can = true;
  saiki(0);
  cout << (can ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}
