#include <bits/stdc++.h>
using namespace std;
using tpl = tuple<long long, long long, long long>;
void fastStream() {
  cin.tie(0);
  std::ios_base::sync_with_stdio(0);
}
int N;
int X[1010];
vector<int> G[1010];
int dp1[1010];
vector<int> dp2[1010][5010];
const int INF = 1 << 29;
int rec1(int pos);
int rec2(int pos, int lef, int index);
int rec1(int pos) {
  if (dp1[pos] >= 0) return dp1[pos];
  return dp1[pos] = rec2(pos, X[pos], 0);
}
int rec2(int pos, int lef, int index) {
  if (dp2[pos][lef][index] >= 0) return dp2[pos][lef][index];
  int res = INF;
  if ((int)G[pos].size() == index) {
    return 0;
  } else {
    int c_node = G[pos][index];
    if (lef - X[c_node] >= 0)
      res = min(res, rec2(pos, lef - X[c_node], index + 1) + rec1(c_node));
    if (lef - rec1(c_node) >= 0)
      res = min(res, rec2(pos, lef - rec1(c_node), index + 1) + X[c_node]);
  }
  return dp2[pos][lef][index] = res;
}
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];
  for (int i = 0; i < N; i++) {
    dp1[i] = -1;
    for (int j = 0; j < 5010; j++) {
      dp2[i][j].resize((int)G[i].size() + 1, -1);
    }
  }
  if (rec1(0) == INF) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << "POSSIBLE" << endl;
  }
  return 0;
}
