#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long kai(long long x, long long y, long long m) {
  long long res = 1;
  for (long long i = x - y + 1; i <= x; i++) {
    res *= i;
    res %= m;
  }
  return res;
}
long long mod_pow(long long x, long long y, long long m) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) {
      res = res * x % m;
    }
    x = x * x % m;
    y >>= 1;
  }
  return res;
}
long long comb(long long x, long long y, long long m) {
  if (y > x) return 0;
  return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}
int n, p[1010], a[1010];
bool bl[1010][5010];
vector<int> vec[1010];
signed main() {
  std::random_device rnd;
  std::mt19937_64 mt(rnd());
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> p[i];
    vec[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = n; i >= 1; i--) {
    if ((int)vec[i].size() == 0) {
      bl[i][0] = true;
      continue;
    }
    for (int j = 0; j < (int)vec[i].size(); j++) {
      int k = vec[i][j];
      bool bo = false;
      for (int l = 0; l <= a[i]; l++)
        if (bl[k][l]) bo = true;
      if (bo) bl[i][a[k]] = true;
      if (a[k] <= a[i])
        for (int l = 0; l <= 5000; l++)
          if (bl[k][l]) bl[i][l] = true;
    }
  }
  bool bo = false;
  for (int i = 0; i <= 5000; i++)
    if (bl[1][i]) bo = true;
  if (bo)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
