#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007, INF = mod * mod * 3LL;
vector<vector<long long> > v;
vector<long long> x;
bool dfs(long long now, long long a = INF, long long b = INF) {
  if (a >= x[now]) {
    a = x[now];
  } else {
    if (b >= x[now])
      b = x[now];
    else
      return false;
  }
  bool ret = true;
  for (auto& to : v[now]) {
    ret &= dfs(to, a, b);
  }
  return ret;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  long long n, a;
  cin >> n;
  v.resize(n);
  x.resize(n);
  for (int i = 1; i < n; i++) {
    cin >> a;
    a--;
    v[a].push_back(i);
  }
  for (int i = 0; i < n; i++) cin >> x[i];
  if (dfs(0))
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
