#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long MOD = 1e9 + 7;
double EPS = 1e-8;
vector<int> es[1010];
vector<int> x;
long long dfs(int cur) {
  if (es[cur].size() == 0) {
    return 0LL;
  }
  long long ret = 1e18;
  vector<vector<long long> > dp(x[cur] + 1, vector<long long>(2, 1e18));
  dp[0][0] = 0;
  int now = 0, nxt = 1;
  for (auto& to : es[cur]) {
    for (int i = (0); i < (int)(dp.size()); i++) dp[i][nxt] = 1e18;
    int tmp = dfs(to);
    for (int i = 0; i + tmp < dp.size(); ++i)
      dp[i + tmp][nxt] = min(dp[i + tmp][nxt], dp[i][now] + x[to]);
    for (int i = 0; i + x[to] < dp.size(); ++i)
      dp[i + x[to]][nxt] = min(dp[i + x[to]][nxt], dp[i][now] + tmp);
    swap(now, nxt);
  }
  for (int i = (0); i < (int)(dp.size()); i++) ret = min(ret, dp[i][now]);
  return ret;
}
int main() {
  string yes = "POSSIBLE", no = "IMPOSSIBLE";
  int n;
  cin >> n;
  for (int i = (0); i < (int)(n - 1); i++) {
    int a;
    cin >> a;
    es[--a].push_back(i + 1);
  }
  x.resize(n);
  for (int i = (0); i < (int)(n); i++) cin >> x[i];
  long long ans = dfs(0);
  if (ans == 1e18)
    cout << no << endl;
  else
    cout << yes << endl;
  return 0;
}
