#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int INF = (long long int)1e15;
struct Vertex {
  vector<int> child;
  int par;
  long long int cost;
  int cnt = 0;
  long long int an = 0;
};
Vertex V[1005];
bool dp[5005];
int main() {
  long long int N;
  cin >> N;
  for (long long int(i) = (0); (i) < (N - 1); ++(i)) {
    long long int p;
    cin >> p;
    p--;
    V[i + 1].par = p;
    V[p].child.push_back(i + 1);
  }
  for (long long int(i) = (0); (i) < (N); ++(i)) {
    cin >> V[i].cost;
  }
  queue<int> q;
  for (long long int(i) = (0); (i) < (N); ++(i)) {
    if (V[i].child.size() == 0) {
      V[V[i].par].cnt++;
      if (V[V[i].par].cnt == V[V[i].par].child.size()) q.push(V[i].par);
    }
  }
  bool ans = true;
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    long long int max = 0;
    long long int sum = 0;
    memset(dp, 0, sizeof(dp));
    dp[0] = true;
    for (long long int(i) = (0); (i) < (V[t].child.size()); ++(i)) {
      int n = V[t].child[i];
      for (int j = V[t].cost; j >= 0; --j) {
        if (j - V[n].cost >= 0 && dp[j - V[n].cost]) dp[j] = true;
        if (j - V[n].an >= 0 && dp[j - V[n].an]) dp[j] = true;
      }
      sum += V[n].cost + V[n].an;
      max = std::max(max, std::min(V[n].cost, V[n].an));
    }
    for (int i = V[t].cost; i >= 0; --i) {
      if (!dp[i]) continue;
      V[t].an = sum - i;
      if (V[t].cost < max) ans = false;
      break;
    }
    V[V[t].par].cnt++;
    if (V[V[t].par].cnt == V[V[t].par].child.size()) q.push(V[t].par);
  }
  if (ans)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
