#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> G[1000];
int X[1000];
int dp[1000];
int dp2[2][5001];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (int i = 1; i < N; i++) {
    int p;
    cin >> p;
    p--;
    G[p].push_back(i);
  }
  for (int i = 0; i < (N); i++) cin >> X[i];
  for (int i = 0; i < (N); i++) dp[i] = 1145141919;
  for (int x = N - 1; x >= 0; x--) {
    for (int i = 0; i < (5001); i++)
      for (int k = 0; k < (2); k++) dp2[k][i] = 1145141919;
    dp2[0][0] = 0;
    for (int t : G[x]) {
      int a = dp[t], b = X[t];
      for (int s = 0; s < (X[x] + 1); s++) {
        if (dp2[0][s] == 1145141919) continue;
        if (s + a <= X[x]) dp2[1][s + a] = min(dp2[1][s + a], dp2[0][s] + b);
        if (s + b <= X[x]) dp2[1][s + b] = min(dp2[1][s + b], dp2[0][s] + a);
      }
      swap(dp2[0], dp2[1]);
    }
    int m = *min_element(dp2[0], dp2[0] + X[x] + 1);
    if (m == 1145141919) {
      cout << "IMPOSSIBLE\n";
      return 0;
    }
    dp[x] = m;
  }
  if (dp[0] == 1145141919)
    cout << "IMPOSSIBLE\n";
  else
    cout << "POSSIBLE\n";
  return 0;
}
