#include <bits/stdc++.h>
using namespace std;
const int N = (int)(1e5) + 5;
vector<int> g[N];
int C[N];
int dp[N];
bitset<20005> cnt;
int main(void) {
  int n;
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int par;
    cin >> par;
    g[par].push_back(i);
  }
  for (int i = 1; i <= n; ++i) cin >> C[i];
  for (int i = n; i; --i) {
    for (int j = 0; j <= 2e4; ++j) cnt[j] = 0;
    int sum = 0;
    for (auto it : g[i]) sum += dp[it] + C[it];
    if (sum > 2e4) return puts("IMPOSSIBLE") * 0;
    cnt[0] = 1;
    for (auto it : g[i]) cnt = (cnt << dp[it]) | (cnt << C[it]);
    int mx = -1;
    for (int j = 0; j <= C[i]; ++j)
      if (cnt[j]) mx = j;
    if (mx == -1) return puts("IMPOSSIBLE") * 0;
    dp[i] = sum - mx;
  }
  puts("POSSIBLE");
  return 0;
}
