#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1007];
int X[1007];
int dp[1007];
void dfs(int curr) {
  for (int nxt : adj[curr]) dfs(nxt);
  int sum = X[curr];
  int childs = adj[curr].size();
  int temp[childs + 1][sum + 1];
  for (int i = 0; i < childs + 1; i++)
    for (int j = 0; j < sum + 1; j++) temp[i][j] = (2000000000);
  for (int i = 0; i < sum + 1; i++) temp[childs][i] = 0;
  for (int i = childs - 1; i >= 0; i--) {
    int child = adj[curr][i];
    for (int remain = sum; remain >= 0; remain--) {
      int ch1 = dp[child];
      int ch2 = X[child];
      int &ans = temp[i][remain];
      if (remain - ch1 >= 0) {
        ans = min(ans, temp[i + 1][remain - ch1] + ch2);
      }
      if (remain - ch2 >= 0) {
        ans = min(ans, temp[i + 1][remain - ch2] + ch1);
      }
    }
  }
  dp[curr] = temp[0][sum];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    adj[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> X[i];
  }
  dfs(0);
  if (dp[0] != (2000000000))
    cout << "POSSIBLE";
  else
    cout << "IMPOSSIBLE";
  return 0;
}
