#include <bits/stdc++.h>
using namespace std;
const long long MAX = 5e3 + 5;
vector<long long> P[MAX];
bitset<MAX> dp;
long long c[MAX];
long long dfs(long long u) {
  dp.reset();
  dp[0] = true;
  long long sum = 0;
  for (auto it : P[u]) {
    long long ile = dfs(it);
    sum += ile + c[it];
    dp = (dp << c[it]) | (dp << ile);
  }
  long long largest = c[u];
  while (largest && !dp[largest]) largest--;
  if (!dp[largest]) cout << "IMPOSSIBLE", exit(0);
  return sum - largest;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 2; i <= n; i++) {
    long long a;
    cin >> a;
    P[a].push_back(i);
  }
  for (long long i = 1; i <= n; i++) cin >> c[i];
  dfs(1);
  cout << "POSSIBLE";
  return 0;
}
