#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long int linf = 1LL << 50;
int n;
int p[1001];
int x[1001];
int dp[1001];
vector<int> vec[1001];
int main(int argc, char const* argv[]) {
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> p[i];
    p[i]--;
    dp[i] = inf;
    vec[p[i]].push_back(i);
  }
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = n - 1; i >= 0; i--) {
    if (vec[i].size() == 0) {
      dp[i] = 0;
    } else if (vec[i].size() == 1) {
      if (x[i] >= x[vec[i][0]] && x[i] >= dp[vec[i][0]]) {
        dp[i] = min(x[vec[i][0]], dp[vec[i][0]]);
      } else if (x[i] < x[vec[i][0]] && x[i] > dp[vec[i][0]]) {
        dp[i] = x[vec[i][0]];
      } else if (x[i] >= x[vec[i][0]] && x[i] < dp[vec[i][0]]) {
        dp[i] = dp[vec[i][0]];
      } else {
        cout << "IMPOSSIBLE" << endl;
        return 0;
      }
    }
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
