#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

void upd(int &x, int y) {
  x = min(x, y);
}

int main() {
  int n;
  cin >> n;

  vector<vector<int>> g(n);
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    g[p - 1].push_back(i);
  }
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }

  vector<int> y(n, 1e9);

  for (int u = n - 1; u >= 0; u--) {
    vector<int> dp(5001, 1e9);
    dp[0] = 0;
    for (int v : g[u]) {
      vector<int> dp1(5001, 1e9);
      for (int i = 0; i <= 5000; i++) {
        if (i + x[v] <= 5000) upd(dp1[i + x[v]], dp[i] + y[v]);
        if (i + y[v] <= 5000) upd(dp1[i + y[v]], dp[i] + x[v]);
      }
      dp = dp1;
    }
    for (int i = 0; i <= x[u]; i++) {
      y[u] = min(y[u], dp[i]);
    }
    if (y[u] == 1e9) {
      puts("IMPOSSIBLE");
      return 0;
    }
  }
  puts("POSSIBLE");
}