#include <bits/stdc++.h>
using namespace std;
std::mt19937 generator;
const int MAXN = 1111;
int p[MAXN];
int x[MAXN];
int d[MAXN];
vector<int> v[MAXN];
int din[MAXN][5 * MAXN];
int n;
void dfs(int k) {
  vector<pair<int, int>> t;
  int sum = 0;
  for (int to : v[k]) {
    dfs(to);
    t.push_back({d[to], x[to]});
    sum += d[to];
    sum += x[to];
  }
  for (int i = 0; i < v[k].size(); i++) {
    for (int j = 0; j < MAXN * 5; j++) {
      din[i][j] = 0;
    }
  }
  if (v[k].size() == 0) {
    return;
  }
  if (t[0].first < 5 * MAXN) {
    din[0][t[0].first] = 1;
  }
  if (t[0].second < 5 * MAXN) {
    din[0][t[0].second] = 1;
  }
  for (int i = 0; i < (int)v[k].size() - 1; i++) {
    for (int j = 0; j < MAXN * 5; j++) {
      if (din[i][j] && j + t[i].first < 5 * MAXN) {
        din[i + 1][j + t[i].first] = 1;
      }
      if (din[i][j] && j + t[i].second < 5 * MAXN) {
        din[i + 1][j + t[i].second] = 1;
      }
    }
  }
  d[k] = 1e9;
  bool was = 0;
  for (int j = 5 * MAXN - 1; j >= 0; j--) {
    if (din[(int)v[k].size() - 1][j]) {
      if (j <= x[k]) {
        d[k] = sum - j;
        was = 1;
        break;
      }
    }
  }
  if (!was) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cin >> n;
  p[0] = -1;
  for (int i = 1; i < n; i++) {
    cin >> p[i];
    p[i]--;
    v[p[i]].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  dfs(0);
  cout << "POSSIBLE" << endl;
  return 0;
}
