#include <bits/stdc++.h>
long long int value[1010], w[1010] = {0}, b[1010] = {0};
bool flag = true;
void dfs(std::vector<std::vector<int> > &g, int current, int parent) {
  if (g[current].size() == 0) w[current] = value[current];
  for (int i = 0; i < g[current].size(); ++i) {
    int child = g[current][i];
    dfs(g, child, current);
    if (w[child] <= value[current]) {
      w[current] = value[current];
      b[current] = b[child];
    } else if (b[child] <= value[current]) {
      b[current] = value[current];
      w[current] = w[child];
    } else
      flag = false;
  }
}
int main() {
  int n;
  std::cin >> n;
  std::vector<std::vector<int> > g(n);
  for (int i = 1; i < n; ++i) {
    int x;
    std::cin >> x;
    --x;
    g[x].push_back(i);
  }
  for (int i = 0; i < n; ++i) {
    std::cin >> value[i];
  }
  dfs(g, 0, -1);
  if (flag)
    std::cout << "POSSIBLE";
  else
    std::cout << "IMPOSSIBLE";
}
