#include <bits/stdc++.h>
using namespace std;
long long Lis(long long *data, long long *dp, long long n) {
  fill(dp, dp + n, (1ll << 60));
  for (long long i = 0; i < (n); ++i) {
    *lower_bound(dp, dp + n, data[i]) = data[i];
  }
  return lower_bound(dp, dp + n, (1ll << 60)) - dp;
}
long long N;
vector<long long> ch[1010];
long long X[1010];
vector<long long> sequence;
long long lisdp[1010];
long long maxlis = -1;
void dfs(long long cur) {
  sequence.push_back(X[cur]);
  if (ch[cur].empty()) {
    maxlis = max(maxlis, Lis(sequence.data(), lisdp, sequence.size()));
    sequence.pop_back();
    return;
  }
  for (long long i = 0; i < (ch[cur].size()); ++i) {
    dfs(ch[cur][i]);
  }
  sequence.pop_back();
}
signed main() {
  cin >> N;
  for (long long i = 0; i < (N - 1); ++i) {
    long long p;
    cin >> p;
    --p;
    ch[p].push_back(i + 1);
  }
  for (long long i = 0; i < (N); ++i) {
    cin >> X[i];
  }
  dfs(0);
  if (maxlis == 2) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  if (maxlis <= 2)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
