#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::lower_bound;
using std::string;
using std::upper_bound;
using std::vector;
using vi = vector<long long>;
using vii = vector<vi>;
using pii = std::pair<long long, long long>;
const long long MOD = 1e9 + 7;
const long long MAX = 1e7;
const long long INF = (1ll << 60);
template <class T>
class prique : public std::priority_queue<T, std::vector<T>, std::greater<T>> {
};
struct Binary_indexed_tree {
  int N;
  vi bit;
  Binary_indexed_tree(int n) : N(n) { bit.resize(N + 1, 0); }
  void add(int x, int a) {
    for (x; x <= N; x += (x & -x)) bit[x] += a;
  }
  long long sum(int x) {
    long long ret = 0;
    for (x; x > 0; x -= (x & -x)) ret += bit[x];
    return ret;
  }
};
struct Union_Find {
  long long N;
  vi par;
  vi siz;
  Union_Find(int n) : N(n) {
    par.resize(N);
    siz.resize(N, 1);
    for (long long i = (long long)(0); i < (long long)(N); i++) par[i] = i;
  }
  long long root(long long X) {
    if (par[X] == X) return X;
    return par[X] = root(par[X]);
  }
  bool same(long long X, long long Y) { return root(X) == root(Y); }
  void unite(long long X, long long Y) {
    X = root(X);
    Y = root(Y);
    if (X == Y) return;
    par[X] = Y;
    siz[Y] += siz[X];
    siz[X] = 0;
  }
  long long size(long long X) { return siz[root(X)]; }
};
long long modpow(long long X, long long Y) {
  long long sum = X, cnt = 1;
  vi A;
  while (cnt <= Y) {
    A.push_back(sum);
    sum *= sum;
    sum %= MOD;
    cnt *= 2;
  }
  int M = A.size();
  long long ret = 1;
  for (long long i = (long long)(1); i <= (long long)(M); i++) {
    if (Y >= (1ll << M - i)) {
      Y -= (1ll << M - i);
      ret *= A[M - i];
      ret %= MOD;
    }
  }
  return ret;
}
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(long long n, long long r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fac[n] * finv[r] % MOD * finv[n - r] % MOD;
}
pii dfs(long long X, vii &edge, vi &A) {
  pii ret = std::make_pair(INF, INF);
  if (edge[X].size() == 0) return std::make_pair(A[X], 0);
  for (long long i = (long long)(0); i < (long long)(edge[X].size()); i++) {
    long long Y = edge[X][i];
    pii memo = dfs(Y, edge, A);
    if (memo.first == INF) return std::make_pair(INF, INF);
    if (memo.first <= A[X]) ret.second = std::min(ret.second, memo.second);
    std::swap(memo.first, memo.second);
    if (memo.first <= A[X]) ret.second = std::min(ret.second, memo.second);
  }
  if (ret.second != INF) ret.first = A[X];
  return ret;
}
signed main() {
  long long N;
  cin >> N;
  vii edge(N);
  vi A(N);
  for (long long i = (long long)(1); i < (long long)(N); i++) {
    long long X;
    cin >> X;
    edge[X - 1].push_back(i);
  }
  for (long long i = (long long)(0); i < (long long)(N); i++) cin >> A[i];
  pii memo = dfs(0, edge, A);
  string ans = "IMPOSSIBLE";
  if (memo.first != INF) ans = "POSSIBLE";
  cout << ans << "\n";
}
