#include <bits/stdc++.h>
using namespace std;
int N;
int p[10000];
int A[10000];
int p2[10000];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> N;
  for (long long i = 2; i <= long long(N); ++i) cin >> p[i];
  for (long long i = 1; i <= long long(N); ++i) cin >> A[i];
  for (long long i = 2; i <= long long(N); ++i) {
    if (A[p[i]] < A[i]) p2[i] = p[i];
  }
  for (long long i = 1; i <= long long(N); ++i) {
    int num = 0;
    int cur = i;
    while (cur != 0) {
      cur = p2[cur];
      num++;
      if (num >= 2) {
        cout << "IMPOSSIBLE";
        return 0;
      }
    }
  }
  cout << "POSSIBLE";
}
