#include <bits/stdc++.h>
using namespace std;
int n, len = 0;
int head[1005], nex[1005], to[1005], v[1005];
void add(int x, int y) {
  to[++len] = y;
  nex[len] = head[x];
  head[x] = len;
}
int dp[1005][5005], tmp[5005];
int dfs(int now) {
  dp[now][0] = 0;
  for (int i = head[now]; i; i = nex[i]) {
    int w = dfs(to[i]), b = v[to[i]];
    for (int j = 0; j < 1005; j++) tmp[j] = dp[now][j];
    memset(dp[now], 0x3f3f3f3f, sizeof(dp[now]));
    for (int j = 0; j <= v[now]; j++) {
      if (j + w <= v[now]) dp[now][j + w] = min(dp[now][j + w], tmp[j] + b);
      if (j + b <= v[now]) dp[now][j + b] = min(dp[now][j + b], tmp[j] + w);
    }
  }
  int ans = dp[0][0];
  for (int i = 0; i <= v[now]; i++) ans = min(ans, dp[now][i]);
  return ans;
}
int main() {
  memset(dp, 0x3f3f3f3f, sizeof(dp));
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    add(x, i);
  }
  for (int i = 1; i <= n; i++) cin >> v[i];
  if (dfs(1) < dp[0][0])
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
