#include <bits/stdc++.h>

using namespace std;

const int INF = 1 << 29;

int N, X[1001];
vector< int > g[1000];

pair< int, int > rec(int idx)
{
  vector< int > dp1(5001, 0);

  for(auto &to : g[idx]) {
    auto get = rec(to);

    vector< int > dp2(5001, INF);
    for(int j = 0; j <= 5000 - get.second; j++) {
      dp2[j + get.second] = min(dp2[j + get.second], dp1[j] + get.first);
    }
    for(int j = 0; j <= 5000 - get.first; j++) {
      dp2[j + get.first] = min(dp2[j + get.first], dp1[j] + get.second);
    }
    dp1.swap(dp2);
  }
  return {X[idx], dp1[X[idx]]};
}

int main()
{

  cin >> N;
  for(int i = 1; i < N; i++) {
    int x;
    cin >> x;
    g[--x].emplace_back(i);
  }
  for(int i = 0; i < N; i++) {
    cin >> X[i];
  }
  if(rec(0).second == INF) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << "POSSIBLE" << endl;
  }
}