#include <bits/stdc++.h>
using namespace std;
int nt[1010] = {0};
int ns[1010] = {0};
int bj[1010][1010] = {0};
void play(int h, int n) {
  queue<int> dfs;
  dfs.push(h);
  while (!dfs.empty()) {
    int tem;
    tem = dfs.front();
    dfs.pop();
    int t;
    for (t = tem + 1; t <= n; t++) {
      if (nt[t] == tem) {
        dfs.push(t);
        if (ns[h] < ns[t]) {
          bj[h][t] = 1;
          bj[0][h]++;
        }
      }
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int t, t1;
  for (t = 2; t <= n; t++) scanf("%d", &nt[t]);
  for (t = 1; t <= n; t++) scanf("%d", &ns[t]);
  for (t = 1; t <= n; t++) play(t, n);
  bool j = 0;
  for (t = 1; t <= n; t++) {
    for (t1 = t + 1; t1 <= n; t1++) {
      if (bj[t][t1] == 1 && bj[0][t1] > 0) j = 1;
      if (j) break;
    }
    if (j) break;
  }
  if (j)
    printf("IMPOSSIBLE\n");
  else
    printf("POSSIBLE\n");
  return 0;
}
