#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;
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;
    int u = i, p = -1, cnt = 0;
    while (u != -1) {
      if (p > xs[u]) {
        if (++cnt == 2) ans = false;
      } else
        cnt = 0;
      p = xs[u];
      u = par[u];
    }
  }
  cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}
