#include <bits/stdc++.h>
using namespace std;
long long INFl = 1e+18 + 1;
int INF = 1e+9 + 1;
int N;
int P[1001], X[1001];
vector<int> ko[1001];
pair<int, int> costmin[1001];
bool solve(int from) {
  costmin[from] = make_pair(X[from], 0);
  int konum = ko[from].size();
  if (konum == 0) return 1;
  for (int i = 0; i < konum; i++) {
    int to = ko[from][i];
    if (solve(to) == 0) {
      return 0;
    }
  }
  vector<vector<int> > knap(konum + 1, vector<int>(X[from] + 1, -1));
  int sum = 0;
  knap[0][0] = 0;
  for (int i = 0; i < konum; i++) {
    int to = ko[from][i];
    for (int w = 0; w < X[from] + 1; w++) {
      if (w >= costmin[to].first)
        knap[i + 1][w] = max(
            knap[i + 1][w], knap[i][w - costmin[to].first] + costmin[to].first);
      if (w >= costmin[to].second)
        knap[i + 1][w] = max(knap[i + 1][w], knap[i][w - costmin[to].second]);
    }
    sum += costmin[to].first;
  }
  int choosemax = knap[konum][X[from]];
  bool canchoose = 0;
  for (int w = 0; w < X[from] + 1; w++)
    if (knap[konum][w] >= 0) canchoose = 1;
  if (canchoose == 0) {
    return 0;
  } else {
    costmin[from].second = sum - choosemax;
  }
  return 1;
}
int main() {
  cin >> N;
  P[0] = -1;
  for (int i = 1; i <= N - 1; i++) {
    cin >> P[i];
    P[i]--;
    ko[P[i]].push_back(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> X[i];
  }
  if (solve(0))
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
