#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int M = 101;
const double EPS = 1e-9;
const int INF = 1e9;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
double getDist(complex<double> a, complex<double> b) {
  return sqrt((a.real() - b.real()) * (a.real() - b.real()) +
              (a.imag() - b.imag()) * (a.imag() - b.imag()));
}
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
long long mod = 1000000007;
long long power(long long base, int p) {
  if (!p) return 1;
  long long ret = power(base, p / 2);
  ret *= ret;
  ret %= mod;
  if (p & 1) ret *= base, ret %= mod;
  return ret;
}
long long modInverse(int a) { return power(a, mod - 2); }
vector<int> adj[N];
int x[N], n, idx[N];
long long dp[N], memo[N][N * 5];
long long solve(int cur, int sum) {
  if (sum < 0) return 1e9;
  if (cur < 0) return 0;
  if (memo[cur][sum] != -1) return memo[cur][sum];
  long long ret = min(solve(cur - 1, sum - dp[idx[cur]]) + x[idx[cur]],
                      solve(cur - 1, sum - x[idx[cur]]) + dp[idx[cur]]);
  return memo[cur][sum] = ret;
}
void dfs(int pair<pair<int, long long>, int>) {
  for (int i = 0; i < adj[pair<pair<int, long long>, int>].size(); i++) {
    dfs(adj[pair<pair<int, long long>, int>][i]);
    idx[i] = adj[pair<pair<int, long long>, int>][i];
    for (int j = 0; j < N * 5; j++) memo[i][j] = -1;
  }
  dp[pair<pair<int, long long>, int>] =
      solve(((int)((adj[pair<pair<int, long long>, int>]).size())) - 1,
            x[pair<pair<int, long long>, int>]);
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int a;
    scanf("%d", &a);
    adj[a].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  memset(dp, 0, sizeof(dp));
  dfs(1);
  if (dp[1] >= 1e9)
    cout << "IMPOSSIBLE";
  else
    cout << "POSSIBLE";
  return 0;
}
