#include <bits/stdc++.h>
using namespace std;
int n, W[100000];
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[100000], last[100000], head[100000];
  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 c, int a, int b) {
  for (int i = E1.head[u]; i; i = E1.last[i]) {
    int v = E1.to[i], C = c, A = a, B = b;
    if (W[v] > W[u]) {
      C ^= 1;
      if (C == 1) {
        if (b <= W[v]) {
          printf("IMPOSSIBLE\n");
          exit(0);
        }
        B = W[v];
      } else {
        if (a <= W[v]) {
          printf("IMPOSSIBLE\n");
          exit(0);
        }
        A = W[v];
      }
    } else {
      C ^= 1;
      if (c)
        A = W[v];
      else
        B = W[v];
    }
    dfs(v, C, A, 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();
  W[0] = 999999999;
  dfs(1, 0, W[1], 999999999);
  printf("POSSIBLE\n");
  return 0;
}
