#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e+9) + 7;
const long long INF = (long long)1000000007 * 1000000007;
const long double eps = 1e-12;
const long double pi = acos(-1.0);
vector<int> G[1000];
int a[1000];
int d[1000][2];
string ans = "POSSIBLE";
void dfs(int id) {
  d[id][1] = 0;
  d[id][0] = a[id];
  for (int i = 0; i < (int)G[id].size(); i++) {
    int v = G[id][i];
    dfs(v);
    if (d[v][1] > a[id]) ans = "IMPOSSIBLE";
    if (d[v][0] > a[id]) d[id][1] = max(d[id][1], a[id]);
    d[id][1] = max(d[id][1], d[v][1]);
    d[id][0] = max(d[id][0], d[v][0]);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int p;
    cin >> p;
    p--;
    G[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dfs(0);
  cout << ans << endl;
  return 0;
}
