#include <bits/stdc++.h>
using namespace std;
const int MC = 5010;
const int INF = 1e9 + 7;
int N;
vector<int> V[1010];
int X[1010];
int b[1010][MC];
void mn(int &s, int t) { s = min(s, t); }
int dfs(int p, int q) {
  fill(b[q], b[q] + MC, INF);
  b[q][0] = 0;
  for (auto u : V[q]) {
    int z = dfs(q, u);
    if (z < 0) return -1;
    for (int i = (int)(MC - 1); i < (int)(-1); ++i) {
      if (i + z < MC) mn(b[q][i + z], b[q][i] + X[u]);
      if (i + X[u] < MC) mn(b[q][i + X[u]], b[q][i] + z);
    }
  }
  int m = INF;
  for (int i = (int)(0); i < (int)(MC); ++i) {
    if (i <= X[q]) mn(m, b[q][i]);
    if (b[q][i] <= X[q]) mn(m, i);
  }
  if (m == INF) m = -1;
  return m;
}
int main() {
  cin >> N;
  for (int i = (int)(1); i < (int)(N); ++i) {
    int P;
    cin >> P;
    V[P].push_back(i + 1);
  }
  for (int i = (int)(1); i < (int)(N + 1); ++i) {
    cin >> X[i];
  }
  cout << (dfs(-1, 1) < 0 ? "IMPOSSIBLE" : "POSSIBLE") << endl;
  return 0;
}
