#include <bits/stdc++.h>
using namespace std;
const long long inf = 123456789;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  for (; !isalnum(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isalnum(ch); ch = getchar()) x = x * 10 + ch - '0';
  return x * f;
}
long long sum[1100], w[1100], f[1100];
vector<long long> e[1100];
inline void dfs(long long g) {
  for (long long i = 0; i <= (long long)e[g].size() - 1; i++) dfs(e[g][i]);
  memset(f, inf, sizeof(f));
  f[0] = 0;
  for (long long i = 0; i <= (long long)e[g].size() - 1; i++) {
    long long k = e[g][i];
    for (long long j = w[g]; j >= 0; j--) {
      long long tmp = inf;
      if (j >= sum[k]) tmp = min(tmp, f[j - sum[k]] + w[k]);
      if (j >= w[k]) tmp = min(tmp, f[j - w[k]] + sum[k]);
      f[j] = tmp;
    }
  }
  for (long long i = w[g]; i >= 0; i--) sum[g] = min(sum[g], f[i]);
}
signed main() {
  memset(sum, inf, sizeof(sum));
  long long n = read();
  for (long long i = 2; i <= n; i++) {
    long long x = read();
    e[x].push_back(i);
  }
  for (long long i = 1; i <= n; i++) w[i] = read();
  dfs(1);
  if (sum[1] < inf)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
