#include <bits/stdc++.h>
using namespace std;
int n;
int p[1000], x[1000];
vector<int> children[1000];
pair<int, int> solve(int v) {
  if (children[v].empty()) return {0, x[v]};
  int ex = -1;
  for (int u : children[v]) {
    auto p = solve(u);
    if (p.second < x[v])
      ex = max(ex, p.first);
    else if (p.first < x[v])
      ex = max(ex, p.second);
    else {
      cout << "IMPOSSIBLE\n";
      exit(0);
    }
  }
  if (ex < x[v])
    return {ex, x[v]};
  else
    return {x[v], ex};
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout.setf(ios_base::fixed, ios_base::floatfield);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> p[i];
    --p[i];
    children[p[i]].push_back(i);
  }
  for (int i = 0; i < n; ++i) cin >> x[i];
  solve(0);
  cout << "POSSIBLE\n";
  return 0;
}
