#include <bits/stdc++.h>
using namespace std;
vector<long long> v[((long long)(1e5 + 100))];
long long dx[2][5006];
pair<long long, long long> dp[((long long)(1e5 + 100))];
long long w[6000];
void go(long long x) {
  for (auto y : v[x]) {
    go(y);
  }
  long long P = 0, N = 1;
  for (int i = 0; i < 5005; i++) dx[P][i] = ((long long)(1e9 + 100));
  dx[P][0] = 0;
  for (auto y : v[x]) {
    for (int i = 0; i < 5004; i++) {
      dx[N][i] = ((long long)(1e9 + 100));
    }
    for (int i = 0; i <= 5000; i++) {
      if (i + dp[y].first <= 5001)
        dx[N][i + dp[y].first] =
            min(dx[N][i + dp[y].first], dx[P][i] + dp[y].second);
      if (i + dp[y].first <= 5001)
        dx[N][i + dp[y].second] =
            min(dx[N][i + dp[y].second], dx[P][i] + dp[y].first);
    }
    swap(N, P);
  }
  dp[x] = {w[x], ((long long)(1e9 + 100))};
  for (int i = 0; i <= w[x]; i++) {
    dp[x] = min(dp[x], {w[x], dx[P][i]});
  }
  if (dp[x].second == ((long long)(1e9 + 100))) {
    cout << "IMPOSSIBLE";
    exit(0);
  }
}
int main() {
  long long n, k;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> k;
    v[k].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  go(1);
  cout << "POSSIBLE";
  return 0;
}
