#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
struct E {
  int to, next;
} edges[10 * maxn];
int first[maxn], te, v[maxn];
bool ans = 1;
void add(int x, int y) {
  te++;
  edges[te].to = y;
  edges[te].next = first[x];
  first[x] = te;
}
void dfs(int p, int mmax, int start) {
  if (ans == 0) return;
  for (int e = first[p]; e; e = edges[e].next) {
    int to = edges[e].to;
    if (mmax == -1) {
      if (v[to] > v[start])
        dfs(to, v[to], start);
      else
        dfs(to, -1, start);
    } else {
      if (v[to] > mmax) {
        ans = 0;
        return;
      } else {
        if (v[to] > v[start])
          dfs(to, min(v[start], mmax), start);
        else
          dfs(to, mmax, start);
      }
    }
    dfs(to, -1, to);
  }
  return;
}
int main() {
  int n;
  cin >> n;
  memset(first, 0, sizeof(first));
  memset(v, 0, sizeof(v));
  ans = 1;
  for (int i = 2; i <= n; i++) {
    int a;
    cin >> a;
    add(a, i);
  }
  for (int i = 1; i <= n; i++) cin >> v[i];
  dfs(1, -1, 1);
  if (!ans)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
}
