#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<vector<int>> g(n);
  for (int i = 1; i < n; i++) {
    int x;
    cin >> x;
    x--;
    g[x].emplace_back(i);
  }
  vector<int> a(n);
  for (auto& x : a) {
    cin >> x;
  }
  vector<pair<int, int>> bak(n);
  bak[0] = {a[0], 1 << 30};
  function<bool(int)> dfs = [&](int u) {
    for (int v : g[u]) {
      bak[v] = bak[u];
      if (a[v] <= bak[u].first) {
        bak[v].first = a[v];
      } else if (a[v] <= bak[u].second) {
        bak[v].second = a[v];
      } else
        return false;
      if (!dfs(v)) return false;
    }
    return true;
  };
  auto res = dfs(0) ? "POSSIBLE" : "IMPOSSIBLE";
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  cout << endl;
}
