#include <bits/stdc++.h>
using namespace std;
int N;
int par[10000];
int A[10000];
int p[10000], depth[10000], second[10000], e[10000];
vector<long long> adj[10000];
pair<long long, long long> val[10000];
int fl(int x) {
  if (p[x] == x) return x;
  return p[x] = fl(p[x]);
}
void join(int a, int b) {
  a = fl(a);
  b = fl(b);
  val[b].first = min(val[b].first, val[a].first);
  val[b].second = max(val[b].second, val[a].second);
  p[a] = b;
}
int cur = 0;
void dfs(int x) {
  second[x] = cur++;
  for (auto i : adj[x]) {
    if (i != par[x]) {
      depth[i] = depth[x] + 1;
      dfs(i);
    }
  }
  e[x] = cur - 1;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> N;
  for (long long i = 2; i <= long long(N); ++i) {
    cin >> par[i];
    adj[i].push_back(par[i]), adj[par[i]].push_back(i);
  }
  for (long long i = 1; i <= long long(N); ++i) cin >> A[i];
  dfs(1);
  for (long long i = 1; i <= long long(N); ++i)
    p[i] = i, val[i] = pair<long long, long long>(depth[i], depth[i]);
  for (long long i = 1; i <= long long(N); ++i) {
    for (long long j = 1; j <= long long(N); ++j) {
      if (i == j) continue;
      if (depth[i] < depth[j] && A[i] < A[j] && second[i] <= second[j] &&
          second[j] <= e[i]) {
        join(i, j);
      }
    }
  }
  for (long long i = 1; i <= long long(N); ++i) {
    if (val[fl(i)].second - val[fl(i)].first >= 2) {
      cout << "IMPOSSIBLE";
      return 0;
    }
  }
  cout << "POSSIBLE";
}
