#include <bits/stdc++.h>
using namespace std;
const int lim = 5001;
int n, i, x[1024], aux;
vector<int> list[1024];
int alt[1024];
int ss, dd;
bool dp[2][5011];
void dfs(int node) {
  int i;
  long long sum = 0;
  memset(dp, 0, sizeof(dp));
  ss = 0;
  dd = 1;
  dp[ss][0] = true;
  for (auto to : list[node]) {
    dfs(to);
    memset(dp[dd], 0, sizeof(dp[dd]));
    for (i = 0; i + alt[to] <= x[node]; i++) dp[dd][i + alt[i]] |= dp[ss][i];
    for (i = 0; i + x[to] <= x[node]; i++) dp[dd][i + x[i]] |= dp[ss][i];
    sum += alt[to] + x[to];
    swap(ss, dd);
  }
  for (i = x[node]; i >= 0; i--)
    if (dp[ss][i]) break;
  if (i < 0) {
    cout << "IMPOSSIBLE";
    exit(0);
  }
  alt[node] = sum - i;
}
int main() {
  cin >> n;
  for (i = 2; i <= n; i++) {
    scanf("%d", &aux);
    list[aux].push_back(i);
  }
  for (i = 1; i <= n; i++) cin >> x[i];
  dfs(1);
  cout << "POSSIBLE";
  return 0;
}
