#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAXVAL = 5000;
const int INF = 1000000000;
vector<int> g[1 + MAXN];
int sum[1 + MAXN], limit = 0;
int dp[1 + MAXN], best[1 + MAXVAL], newBest[1 + MAXVAL];
void DFS(int node) {
  if (!g[node].size()) {
    dp[node] = 0;
    return;
  }
  for (auto &son : g[node]) DFS(son);
  for (int i = 0; i <= MAXVAL; i++) best[i] = INF;
  for (auto &son : g[node]) {
    for (int i = 0; i <= MAXVAL; i++) newBest[i] = best[i];
    for (int i = MAXVAL; i >= sum[son]; i--)
      newBest[i] = min(newBest[i], best[i - sum[son]] + dp[son]);
    for (int i = MAXVAL; i >= dp[son]; i--)
      newBest[i] = min(newBest[i], best[i - dp[son]] + sum[son]);
    newBest[dp[son]] = min(newBest[dp[son]], sum[son]);
    newBest[sum[son]] = min(newBest[sum[son]], dp[son]);
    for (int i = 0; i <= MAXVAL; i++) best[i] = newBest[i];
  }
  dp[node] = INF;
  for (int i = 0; i <= sum[node]; i++) dp[node] = min(dp[node], best[i]);
  if (dp[node] == INF) {
    printf("IMPOSSIBLE\n");
    exit(0);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    g[x].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &sum[i]);
    limit = max(limit, sum[i]);
  }
  DFS(1);
  printf("POSSIBLE\n");
  return 0;
}
