#include <bits/stdc++.h>
using namespace std;
int p[2000];
int x[2000];
int n;
int z;
int ma;
int as;
vector<int> a[2000];
void dfs(int k) {
  int q;
  int r;
  if (x[k] <= z) {
    q = 0;
    r = z;
    z = x[k];
  } else if (x[k] <= ma) {
    q = 1;
    r = ma;
    ma = x[k];
  } else {
    as = 1;
    return;
  }
  for (int i = 0; i < a[k].size(); i++) {
    dfs(a[k][i]);
  }
  if (q == 0) z = r;
  if (q == 1) ma = r;
  return;
}
int main(void) {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d", &p[i]);
    a[p[i] - 1].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  as = 0;
  z = 100000;
  ma = 100000;
  dfs(0);
  if (as == 0)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
