#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int maxn(int a, int b, int c) { return max(max(a, b), max(b, c)); }
long long quick(long long x, long long n, long long mod) {
  long long ans = 1, temp = x % mod;
  while (n) {
    if (n % 2 == 1) {
      ans = (ans * temp) % mod;
    }
    n /= 2;
    temp = temp * temp % mod;
  }
  return ans % mod;
}
vector<int> a[1210];
int b[1200];
int dp[1200];
int vis[1200][1200];
int flag = 1;
void dfs(int x) {
  int sum = 0;
  for (int i = 0; i < a[x].size(); i++) dfs(a[x][i]);
  if (flag == 0) return;
  for (int i = 0; i < a[x].size(); i++) {
    int c = a[x][i];
    sum += b[x] + dp[x];
    for (int j = 0; j <= b[x]; j++) {
      vis[i + 1][j] = -1000000000;
      if (j >= dp[c]) {
        vis[i + 1][j] = max(vis[i + 1][j], vis[i][j - dp[c]] + dp[c]);
      }
      if (j >= b[c]) {
        vis[i + 1][j] = max(vis[i + 1][i], vis[i][j - b[c]] + b[c]);
      }
    }
  }
  if (vis[a[x].size()][b[x]] < 0) {
    flag = 0;
    dp[x] = 1000000000;
  } else {
    dp[x] = sum - vis[a[x].size()][b[x]];
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[x].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  dfs(1);
  if (flag == 0)
    printf("IMPOSSIBLE\n");
  else {
    printf("POSSIBLE\n");
  }
  return 0;
}
