#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
const int INF = (int)1e9 + 7;
const long long linf = (long long)1e16 + 7;
const long long MOD = (long long)1e16 + 7;
const long long base = 11;
const int MAXN = (int)1e5 + 7;
vector<vector<int>> g, dp;
vector<int> x;
bool dfs(int v) {
  if (g[v].size() == 0) {
    dp[v][0] = x[v];
    dp[v][x[v]] = 0;
    return true;
  }
  bool ans = false;
  int bl = 0, wh = 0;
  for (const auto &to : g[v]) {
    if (!dfs(to)) return false;
    for (int i = 0; i < 5001; ++i) {
      if (dp[to][i] != INF) {
        wh += i;
        bl += dp[to][i];
        break;
      }
    }
  }
  if (bl <= x[v]) {
    dp[v][wh] = x[v];
    ans = true;
  }
  if (wh <= x[v]) {
    dp[v][x[v]] = min(dp[v][x[v]], bl);
    ans = true;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  dp.resize(n, vector<int>(5001, INF));
  g.resize(n);
  for (int i = 1; i < n; ++i) {
    int fr;
    cin >> fr;
    fr--;
    g[fr].push_back(i);
  }
  x.resize(n);
  for (int i = 0; i < n; ++i) cin >> x[i];
  if (dfs(0))
    cout << "POSSIBLE";
  else
    cout << "IMPOSSIBLE";
  return 0;
}
