#include <bits/stdc++.h>
using namespace std;
int N;
int Xn[1010];
pair<int, int> currentV[1010];
int parents[1010];
vector<int> children[1010];
int main() {
  scanf("%d", &N);
  parents[0] = -1;
  for (int i = 0; i < (N - 1); ++i) {
    int pair<int, int>;
    scanf("%d", &pair<int, int>);
    --pair<int, int>;
    parents[i + 1] = pair<int, int>;
    children[pair<int, int>].push_back(i + 1);
  }
  for (int i = 0; i < (N); ++i) {
    int X;
    scanf("%d", &X);
    Xn[i] = X;
  }
  queue<int> Q;
  fill(begin(currentV), end(currentV), pair<int, int>(-1, -1));
  for (int i = 0; i < (N); ++i) {
    if (children[i].empty()) {
      Q.push(i);
      currentV[i] = pair<int, int>(0, Xn[i]);
    }
  }
  while (!Q.empty()) {
    int& cur = Q.front();
    Q.pop();
    int p = parents[cur];
    if (currentV[p].first != -1) continue;
    bool ok = true;
    for (auto it = begin(children[p]); it != end(children[p]); ++it) {
      int c = *it;
      if (currentV[c].first == -1) {
        ok = false;
        break;
      }
    }
    if (!ok) {
      Q.push(cur);
      continue;
    }
    set<int> Ss;
    for (int i = 0; i < children[p].size(); ++i) {
      int c = children[p][i];
      Ss.insert(currentV[c].first);
      Ss.insert(currentV[c].second);
    }
    if (*Ss.begin() == 0) {
      if (Ss.size() >= 4 || *Ss.rbegin() > Xn[cur]) {
        printf("IMPOSSIBLE\n");
        return 0;
      }
      currentV[p] = pair<int, int>(*(++Ss.rbegin()), Xn[cur]);
    } else {
      if (Ss.size() >= 2 || *Ss.rbegin() > Xn[cur]) {
        printf("IMPOSSIBLE\n");
        return 0;
      }
      currentV[p] = pair<int, int>(*Ss.begin(), Xn[cur]);
    }
    Q.push(p);
  }
  printf("POSSIBLE\n");
  return 0;
}
