#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
void fail(void) {
  cout << "IMPOSSIBLE" << endl;
  exit(0);
}
int main(void) {
  int n;
  cin >> n;
  vector<int> p(n, -1);
  for (int i = (int)(1); i < (int)(n); i++) {
    cin >> p[i];
    p[i]--;
  }
  vector<int> x(n);
  for (int i = (int)(0); i < (int)(n); i++) {
    cin >> x[i];
  }
  for (int i = (int)(0); i < (int)(n); i++) {
    int b = p[i];
    if (b == -1) {
      continue;
    }
    int a = p[b];
    if (a == -1) {
      continue;
    }
    if (x[a] < x[b] && x[b] < x[i]) {
      fail();
    }
  }
  cout << "POSSIBLE" << endl;
}
