#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}
bool prime(long long x) {
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return x != 1;
}
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 res = 1;
  for (long long i = x - y + 1; i <= x; i++) {
    res *= i;
    res %= (long long)(1e9 + 7);
  }
  return res;
}
long long mod_pow(long long x, long long y,
                  long long m = (long long)(1e9 + 7)) {
  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) {
  if (y > x) return 0;
  return kai(x, y) *
         mod_pow(kai(y, y), (long long)(1e9 + 7) - 2, (long long)(1e9 + 7)) %
         (long long)(1e9 + 7);
}
long long get_rand(long long MIN, long long MAX) {
  std::random_device rnd;
  std::mt19937 mt32(rnd());
  std::uniform_int_distribution<long long> engine(MIN, MAX);
  return engine(mt32);
}
struct BIT {
  vector<long long> bit;
  long long n;
  BIT(long long x) {
    bit.resize(x, 0);
    n = x;
  }
  void add(long long x, long long y) {
    while (x <= n) {
      bit[x] += y;
      x += x & -x;
    }
  }
  long long sum(long long x) {
    long long res = 0;
    while (x > 0) {
      res += bit[x];
      x -= x & -x;
    }
    return res;
  }
};
long long n;
vector<long long> G[1005];
long long point[1005];
long long parmi[1005], childma[1005];
bool used[1005];
void dfs(long long x) {
  used[x] = true;
  for (long long i : G[x]) {
    if (!used[i]) {
      chmin(parmi[i], min(parmi[x], point[x]));
      dfs(i);
      chmax(childma[x], max(childma[i], point[i]));
    }
  }
  if (parmi[x] < point[x] && point[x] < childma[x]) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
}
signed main() {
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long a;
    cin >> a;
    a--;
    G[a].push_back(i);
  }
  for (long long i = 0; i < n; i++) cin >> point[i];
  for (long long i = 0; i < n; i++) {
    parmi[i] = (long long)(3e18), childma[i] = -(long long)(3e18);
  }
  dfs(0);
  cout << "POSSIBLE" << endl;
}
