#include <bits/stdc++.h>
using ull = unsigned long long;
using namespace std;
const long long INF = 1ll << 60;
const long long MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return 1;
  } else
    return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  } else
    return 0;
}
void Yes(bool flag = true) {
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
void No(bool flag = true) { Yes(!flag); }
void YES(bool flag = true) {
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
void NO(bool flag = true) { YES(!flag); }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
  std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
long long N, P[1010], X[1010];
vector<long long> C[1010];
bool flag = true;
pair<long long, long long> dfs(long long idx) {
  long long First = 0;
  long long Second = 0;
  long long SUM = 0;
  bitset<5555> BIT(1);
  for (auto& nxt : C[idx]) {
    auto tmp = dfs(nxt);
    long long a = tmp.first;
    long long b = tmp.second;
    BIT <<= b;
    BIT |= (BIT << (a - b));
    SUM += a + b;
    Second += b;
    First += a;
  }
  if (First <= X[idx]) {
    return {X[idx], Second};
  }
  for (long long i = X[idx]; i >= Second; i--) {
    if (BIT[i]) {
      return {SUM - i, X[idx]};
    }
  }
  flag = false;
  return {0, 0};
}
void solve() {
  dfs(0);
  if (flag)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cin >> N;
  for (long long i = 0; i < (N - 1); ++i) {
    cin >> P[i];
    P[i]--;
    C[P[i]].emplace_back(i + 1);
  }
  for (long long i = 0; i < (N); ++i) {
    cin >> X[i];
  }
  solve();
  return 0;
}
