#include <bits/stdc++.h>
using namespace std;
long long N;
vector<vector<long long>> Kids;
vector<long long> X;
pair<long long, long long> dfs(long long v) {
  long long r = 0;
  for (long long w : Kids[v]) {
    long long x0, x1;
    tie(x0, x1) = dfs(w);
    if (x0 < 0) return make_pair(-1, -1);
    if (x1 <= X[v])
      r = max(r, x0);
    else if (x0 <= X[v])
      r = max(r, x1);
    else
      return make_pair(-1, -1);
  }
  long long r0 = r, r1 = X[v];
  if (r0 > r1) swap(r0, r1);
  return make_pair(r0, r1);
}
int main() {
  cin >> N;
  Kids.resize(N);
  for (long long v = 1; v < N; ++v) {
    long long p;
    cin >> p;
    --p;
    Kids[p].push_back(v);
  }
  X.resize(N);
  for (long long v = 0; v < N; ++v) cin >> X[v];
  cout << (dfs(0).first >= 0 ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}
