#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;
vector<vector<int>> g;
vector<int> x;
vector<int> y;
void dfs(int v, int p = -1) {
  vector<int> dp(5001, 1 << 10);
  dp[0] = 0;
  for (auto c : g[v]) {
    dfs(c, v);
    vector<int> dp2(5001, 1 << 10);
    for (int i = 0; i <= 5000; ++i) {
      if (i - x[c] >= 0) dp2[i] = min(dp2[i], dp[i - x[c]] + y[c]);
      if (i - y[c] >= 0) dp2[i] = min(dp2[i], dp[i - y[c]] + x[c]);
    }
    dp = dp2;
  }
  y[v] = 1 << 10;
  for (int i = 0; i <= x[v]; ++i) {
    y[v] = min(y[v], dp[i]);
  }
}
int main() {
  int n;
  cin >> n;
  x.resize(n);
  g.resize(n);
  for (int i = 1; i < n; ++i) {
    int p;
    cin >> p;
    --p;
    g[p].push_back(i);
  }
  for (int i = 0; i < n; ++i) cin >> x[i];
  y.resize(n, 0);
  dfs(0);
  if (y[0] >= 1 << 10)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
  return 0;
}
