#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> X;
vector<int> W;
vector<vector<int> > P;
const int Xmax = 114514;
bool dfs(int id) {
  long int total = 0;
  bool oks[Xmax];
  bool toks[Xmax];
  oks[0] = true;
  for (int i = 0; i < P[id].size(); ++i) {
    if (!dfs(P[id][i])) {
      return false;
    }
    for (int k = 0; k < Xmax; ++k) {
      if (oks[k]) {
        toks[k + X[P[id][i]]] = true;
        toks[k + W[P[id][i]]] = true;
      }
    }
    for (int k = 0; k < Xmax; ++k) {
      oks[k] = toks[k];
    }
    total += X[P[id][i]] + W[P[id][i]];
  }
  bool possible = false;
  for (int i = 0; i <= total; ++i) {
    if (oks[i] && total - i <= X[id]) {
      W[id] = i;
      possible = true;
      break;
    }
  }
  return possible;
}
int main() {
  cin >> N;
  X.resize(N);
  P.resize(N);
  W.resize(N);
  for (int i = 0; i < N - 1; ++i) {
    int p;
    cin >> p;
    P[p - 1].push_back(i + 1);
  }
  for (int i = 0; i < N; ++i) {
    cin >> X[i];
  }
  cout << (dfs(0) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}
