#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10, maxn = 5050;
vector<int> G[N];
int w[N], f[N], c[N];
int dp[2][maxn];
void dfs(int k) {
  for (int i = G[k].size() - 1; i >= 0; i--) dfs(G[k][i]);
  memset(dp, 0, sizeof(dp));
  int x = 1;
  for (int i = G[k].size() - 1; i >= 0; i--, x ^= 1) {
    int u = G[k][i];
    memset(dp[x], 0x3f, sizeof(dp[x]));
    for (int j = w[k]; j >= 0; j--) {
      if (j >= w[u]) dp[x][j] = min(dp[x][j], dp[x ^ 1][j - w[u]] + f[u]);
      if (j >= f[u]) dp[x][j] = min(dp[x][j], dp[x ^ 1][j - f[u]] + w[u]);
    }
  }
  f[k] = 0x3f3f3f3f;
  for (int i = 0; i <= w[k]; i++) f[k] = min(f[k], dp[x ^ 1][i]);
}
int main() {
  int n;
  cin >> n;
  for (int a, i = 2; i <= n; i++) {
    scanf("%d", &a);
    G[a].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  dfs(1);
  if (f[1] < 10000)
    cout << "POSSIBLE";
  else
    cout << "IMPOSSIBLE";
  return 0;
}
