#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long int N = 1e3 + 100, M = 5e3 + 100;
long long long long int dp[N];
long long long long int val[N];
vector<long long int> g[N];
long long long long int pd[N][M];
long long long long int dfs(long long long long int v) {
  if (g[v].size() == 0) {
    dp[v] = 0;
    return 0;
  }
  for (auto u : g[v]) {
    dfs(u);
  }
  for (long long int i = 0; i <= g[v].size(); i++) {
    for (long long int j = 0; j < M; j++) {
      pd[i][j] = 1e9;
    }
  }
  pd[0][0] = 0;
  for (long long int i = 1; i <= g[v].size(); i++) {
    long long long long int u = g[v][i - 1];
    for (long long int j = 0; j <= val[v]; j++) {
      if (j >= val[u]) {
        pd[i][j] = min(pd[i][j], pd[i - 1][j - val[u]] + dp[u]);
      }
      if (j >= dp[u]) {
        pd[i][j] = min(pd[i][j], pd[i - 1][j - dp[u]] + val[u]);
      }
    }
  }
  dp[v] = 1e9;
  for (long long int i = 0; i <= val[v]; i++) {
    dp[v] = min(dp[v], pd[g[v].size()][i]);
  }
  if (dp[v] > N) {
    cout << "IMPOSSIBLE";
    exit(0);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long long long int n;
  cin >> n;
  for (long long int i = 2; i <= n; i++) {
    long long long long int x;
    cin >> x;
    g[x].push_back(i);
  }
  for (long long int i = 1; i <= n; i++) {
    cin >> val[i];
  }
  dfs(1);
  cout << "POSSIBLE";
}
