#include <bits/stdc++.h>
using namespace std;
int n, W[200000];
int read() {
  int x = 0, k = 1;
  char c;
  c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') k = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * k;
}
struct edge {
  int cnp, to[200000], last[200000], head[200000];
  edge() { cnp = 2; }
  void add(int u, int v) { to[cnp] = v, last[cnp] = head[u], head[u] = cnp++; }
} E1;
void dfs(int u, int a, int b) {
  for (int i = E1.head[u]; i; i = E1.last[i]) {
    int v = E1.to[i];
    if (W[v] >= a && W[v] >= b) {
      printf("IMPOSSIBLE\n");
      exit(0);
    }
    if (W[v] >= a) {
      dfs(v, a, W[v]);
    } else if (W[v] >= b) {
      dfs(v, W[v], b);
    } else {
      if (a > b)
        dfs(v, a, W[v]);
      else
        dfs(v, W[v], b);
    }
  }
}
int main() {
  n = read();
  for (int i = 2; i <= n; i++) {
    int x = read();
    E1.add(x, i);
  }
  for (int i = 1; i <= n; i++) W[i] = read();
  dfs(1, W[1], 999999999);
  printf("POSSIBLE\n");
  return 0;
}
