#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;
template <class S, class T>
istream& operator>>(istream& is, pair<S, T>& p) {
  return is >> p.first >> p.second;
}
template <class S, class T>
ostream& operator<<(ostream& os, const pair<S, T>& p) {
  return os << p.first << " " << p.second;
}
template <class T>
void maxi(T& x, T y) {
  if (x < y) x = y;
}
template <class T>
void mini(T& x, T y) {
  if (x > y) x = y;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const int INF = 1e9;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  VI par(N);
  par[0] = -1;
  vector<bool> leaf(N, true);
  for (int i = (0); i < (N - 1); ++i) {
    cin >> par[i + 1];
    --par[i + 1];
    leaf[par[i + 1]] = false;
  }
  VI xs(N);
  for (int i = (0); i < (N); ++i) cin >> xs[i];
  bool ans = true;
  for (int i = (0); i < (N); ++i) {
    if (!leaf[i]) continue;
    VI buf;
    int u = i;
    while (u != -1) {
      buf.push_back(xs[u]);
      u = par[u];
    }
    VI lis(N + 1, INF);
    for (int j = (0); j < (int((buf).size())); ++j)
      *upper_bound(begin((lis)), end((lis)), buf[j]) = buf[j];
    int it = 0;
    VI rest;
    for (int j = (0); j < (N + 1); ++j) {
      if (lis[j] == INF) break;
      while (buf[it] != lis[j]) {
        rest.push_back(buf[it]);
        ++it;
      }
      ++it;
    }
    for (int j = (0); j < (int((rest).size()) - 1); ++j)
      if (rest[j] > rest[j + 1]) ans = false;
  }
  cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}
