#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, p, a[N], c[N], ans = 1;
vector<int> v[N];
vector<int> adj[N], adj2[N];
void dfs(int pos) {
  for (int &nxt : adj[pos]) {
    dfs(nxt);
    for (int &cur : v[nxt]) {
      if (a[pos] < a[cur]) {
        adj2[pos].push_back(cur);
        adj2[cur].push_back(pos);
        v[pos].push_back(cur);
      }
    }
  }
  v[pos].push_back(pos);
}
void dfs2(int pos) {
  for (int &nxt : adj2[pos]) {
    if (c[nxt]) {
      if (c[nxt] != 3 - c[pos]) {
        ans = 0;
      }
    } else {
      c[nxt] = 3 - c[pos];
      dfs2(nxt);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> p;
    adj[p].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dfs(1);
  c[1] = 1;
  dfs2(1);
  if (!ans) {
    cout << "IM";
  }
  cout << "POSSIBLE\n";
}
