#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll LINF = 1001002003004005006ll;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
int n;
vector<int> g[1001];
int x[1001];
set<int> st[1001];
set<pair<int, int>> dfs(int pre, int now) {
  set<pair<int, int>> res;
  for (auto to : g[now])
    if (pre != to) {
      auto ps = dfs(now, to);
      for (auto p : ps) res.insert(p);
    }
  set<pair<int, int>> ret;
  if (res.empty()) {
    ret.insert(make_pair(x[now], 0));
  }
  for (auto &p : res) {
    if (p.second > x[now])
      continue;
    else if (p.first > x[now])
      ret.insert(make_pair(max(p.first, x[now]), min(p.first, x[now])));
    else {
      ret.insert(make_pair(max(p.first, x[now]), min(p.first, x[now])));
      ret.insert(make_pair(max(p.second, x[now]), min(p.second, x[now])));
    }
  }
  return ret;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin >> n;
  for (int u = 1; u < n; u++) {
    int v;
    cin >> v;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < (n); i++) cin >> x[i];
  cout << (dfs(-1, 0).empty() ? "IM" : "") << "POSSIBLE\n";
  return 0;
}
