#include <bits/stdc++.h>
using namespace std;
long long N;
long long X[1010];
long long P[1010];
vector<long long> C[1010];
pair<long long, long long> cp[1010];
pair<long long, long long> solve(long long n) {
  for (long long i = 1; i <= C[n].size(); i++) {
    cp[i] = solve(C[n][i - 1]);
  }
  long long M = 0;
  long long m = 0;
  for (long long i = 1; i <= C[n].size(); i++) {
    long long M1 = M, m1 = m, M2 = M, m2 = m;
    long long other1 = 100000000000, other2 = 100000000000;
    M1 += cp[i].first;
    m1 += cp[i].second;
    if (M1 < m1) swap(M1, m1);
    if (M1 > X[n] && m1 < X[n]) {
      other1 = M1;
    } else if (M1 <= X[n]) {
      other1 = m1;
    }
    M2 += cp[i].second;
    m2 += cp[i].first;
    if (M2 < m2) swap(M2, m2);
    if (M2 > X[n] && m2 < X[n]) {
      other2 = M2;
    } else if (M2 <= X[n]) {
      other2 = m2;
    }
    if (other1 == 100000000000 && other2 == 100000000000) {
      cout << "IMPOSSIBLE" << endl;
      exit(0);
    } else if (other1 < other2) {
      M = M1;
      m = m1;
    } else {
      M = M2;
      m = m2;
    }
  }
  if (M < m) swap(M, m);
  if (M <= X[n])
    return make_pair(X[n], m);
  else
    return make_pair(X[n], M);
}
signed main(void) {
  cin >> N;
  X[1] = 1;
  for (long long i = 2; i <= N; i++) {
    cin >> P[i];
    C[P[i]].push_back(i);
  }
  for (long long i = 1; i <= N; i++) cin >> X[i];
  solve(1);
  cout << "POSSIBLE" << endl;
  return 0;
}
