#include <bits/stdc++.h>
using namespace std;
long long int Pow(long long int a, long long int b, long long int md,
                  long long int ans = 1) {
  for (; b; b >>= 1, a = a * a % md)
    if (b & 1) ans = ans * a % md;
  return ans % md;
}
const long long int MAXN = 5e3 + 20;
const long long int INF = 8e18;
const long long int MOD = 1e9 + 7;
long long int dp[MAXN], pd[2][MAXN], X[MAXN], n, ridi = 0;
vector<long long int> adj[MAXN];
void DFS(long long int v) {
  dp[v] = INF;
  for (long long int u : adj[v]) {
    DFS(u);
  }
  pd[0][0] = 0;
  for (long long int i = 1; i <= (long long int)adj[v].size(); i++) {
    long long int u = adj[v][i - 1];
    for (long long int j = MAXN - X[u]; j >= 0; j--) {
      pd[i & 1][j + X[u]] =
          min(pd[i & 1][j + X[u]], pd[1 - (i & 1)][j] + dp[u]);
    }
    for (long long int j = MAXN - dp[u]; j >= 0; j--) {
      pd[i & 1][j + dp[u]] =
          min(pd[i & 1][j + dp[u]], pd[1 - (i & 1)][j] + X[u]);
    }
  }
  for (long long int i = 0; i <= X[v]; i++) {
    dp[v] = min(dp[v], pd[(long long int)adj[v].size() & 1][i]);
  }
  for (long long int i = 0; i < 2; i++) {
    for (long long int j = 0; j < MAXN; j++) pd[i][j] = INF;
  }
  if (dp[v] >= INF / 10) ridi = 1;
}
int main() {
  scanf("%lld", &n);
  for (long long int i = 2; i <= n; i++) {
    long long int p;
    scanf("%lld", &p);
    adj[p].push_back(i);
  }
  for (long long int i = 1; i <= n; i++) scanf("%lld", &X[i]);
  DFS(1);
  if (ridi)
    printf("IMPOSSIBLE\n");
  else
    printf("POSSIBLE\n");
  return 0;
}
