#include <bits/stdc++.h>
using namespace std;
const int INF = 1e+6;
int dp[5001];
int dp_[5001];
vector<int> G[1000];
int min_pair[1000];
int X[1000];
int N;
void copy_dp() {
  for (int i = 0; i <= 5000; i++) {
    dp_[i] = dp[i];
  }
}
void clear_dp_both() {
  for (int i = 0; i <= 5000; i++) {
    dp_[i] = INF;
    dp[i] = INF;
  }
}
void clear_dp() {
  for (int i = 0; i <= 5000; i++) {
    dp[i] = INF;
  }
}
void dfs(int v) {
  clear_dp_both();
  dp_[0] = 0;
  for (int i = 0; i < G[v].size(); i++) {
    dfs(G[v][i]);
    int a = X[G[v][i]];
    int b = min_pair[G[v][i]];
    for (int j = 0; j <= X[i]; j++) {
      if (j + a <= X[v] && dp_[j] != INF)
        dp[j + a] = min(dp[j + a], dp_[j] + b);
      if (j + b <= X[v] && dp_[j] != INF)
        dp[j + b] = min(dp[j + b], dp_[j] + a);
    }
    copy_dp();
    clear_dp();
  }
  min_pair[v] = INF;
  for (int j = 0; j <= X[v]; j++) {
    min_pair[v] = min(min_pair[v], dp_[j]);
  }
}
int main() {
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int P;
    cin >> P;
    P--;
    G[P].push_back(i + 1);
  }
  for (int i = 0; i < N; i++) {
    cin >> X[i];
  }
  dfs(0);
  if (min_pair[0] == INF) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << "POSSIBLE" << endl;
  }
}
