#include <bits/stdc++.h>
using namespace std;
vector<int> V[10005];
int dp[10005];
int minn[10005];
int x[10005];
void dfs(int u, int f) {
  if (u == 0) return;
  for (int i = 0; i < V[u].size(); i++) {
    int v = V[u][i];
    if (v == u) continue;
    if (v == 0) continue;
    dfs(v, u);
  }
  memset(dp, 0x3f3f3f3f, sizeof(dp));
  dp[0] = 0;
  for (int i = 0; i < V[u].size(); i++) {
    int v = V[u][i];
    for (int j = x[u]; j >= 0; j--) {
      int tmp = 0x3f3f3f3f;
      if (j >= x[v]) tmp = min(tmp, dp[j - x[v]] + minn[v]);
      if (j >= minn[v]) tmp = min(tmp, dp[j - minn[v]] + x[v]);
      dp[j] = min(dp[j], tmp);
    }
  }
  for (int i = 0; i <= x[u]; i++) minn[u] = min(minn[u], dp[i]);
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int fa;
    scanf("%d", &fa);
    V[fa].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  dfs(1, 0);
  if (minn[1] != 0x3f3f3f3f)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
}
