#include <bits/stdc++.h>
using namespace std;
int p[1000];
int a[1000];
vector<int> r[1000];
int e[1000];
pair<int, int> k[1000];
pair<int, int> S[1000];
void DFS(int b, int c) {
  for (int d : r[b]) {
    if (d != c) {
      e[d] = e[b] + 1;
      DFS(d, b);
    }
  }
}
signed main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> p[i];
    p[i]--;
    r[i].push_back(p[i]);
    r[p[i]].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  DFS(0, -1);
  for (int i = 0; i < n; i++) {
    k[i] = {e[i], i};
  }
  sort(k, k + n, greater<pair<int, int> >());
  for (int i = 0; i < n; i++) {
    if (S[k[i].second].first < a[k[i].second]) {
      puts("IMPOSSIBLE");
      return 0;
    } else if (S[k[i].second].second <= a[k[i].second]) {
      S[k[i].second].first = a[k[i].second];
    } else {
      S[k[i].second] = {0, a[k[i].second]};
    }
    S[p[k[i].second]].first =
        max(S[p[k[i].second]].first, S[k[i].second].first);
    S[p[k[i].second]].second =
        max(S[p[k[i].second]].second, S[k[i].second].second);
  }
  puts("POSSIBLE");
}
