#include <bits/stdc++.h>
using namespace std;
long long N;
long long p[1000];
long long A[1000];
vector<long long> adj[1000];
long long dp[1000];
long long dp2[1000][500];
long long B[1000];
bool vis[1000];
bool np = 0;
void dfs(long long x) {
  if (vis[x] || np) {
    np = 1;
    return;
  }
  vis[x] = 1;
  dp[x] = 1e9;
  for (auto i : adj[x]) {
    dfs(i);
  }
  long long sm = 0;
  for (long long i = 0; i <= (long long)adj[x].size() - 1; i++) {
    B[i] = abs(A[adj[x][i]] - dp[adj[x][i]]);
    sm += min(A[adj[x][i]], dp[adj[x][i]]);
  }
  if (A[x] < sm) {
    dp[x] = 1e9;
    return;
  }
  for (long long i = 0; i <= (long long)adj[x].size() - 1; i++) {
    for (long long j = 0; j <= (long long)A[x] - sm; j++) {
      dp2[i][j] = 1e9;
      if (i == 0) {
        dp2[i][j] = B[i];
        if (j >= B[i]) dp2[i][j] = 0;
      } else {
        if (j >= B[i])
          dp2[i][j] = min(dp2[i - 1][j] + B[i], dp2[i - 1][j - B[i]]);
        else
          dp2[i][j] = dp2[i - 1][j] + B[i];
      }
    }
  }
  if (adj[x].empty())
    dp[x] = 0;
  else
    dp[x] = dp2[adj[x].size() - 1][A[x] - sm] + sm;
}
int32_t main() {
  cin >> N;
  for (long long i = 2; i <= (long long)N; i++) {
    cin >> p[i];
    adj[p[i]].push_back(i);
  }
  for (long long i = 1; i <= (long long)N; i++) cin >> A[i];
  dfs(1);
  if (dp[1] == 1e9 || np)
    cout << "IMPOSSIBLE";
  else
    cout << "POSSIBLE";
}
