#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
const int MAXX = 5005;
const int INF = (long long)1e9 + 5;
bool dp[MAXN][MAXX];
int sum[MAXN], X[MAXN], N;
vector<int> ch[MAXN];
void nope() {
  cout << "IMPOSSIBLE\n";
  exit(EXIT_SUCCESS);
}
void dfs(int v) {
  if (ch[v].empty()) {
    dp[v][X[v]] = 1;
    sum[v] = X[v];
    return;
  }
  for (int to : ch[v]) {
    dfs(to);
    sum[v] += sum[to];
  }
  for (int to : ch[v]) {
    for (int i = 5000; i >= 0; i--) {
      if (i - X[to] >= 0) dp[v][i] |= dp[to][X[to]];
      if (i - (sum[to] - X[to])) dp[v][i] |= dp[to][sum[to] - X[to]];
    }
  }
  if (!dp[v][X[v]]) nope();
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  for (int i = 2; i <= N; i++) {
    int p;
    cin >> p;
    ch[p].push_back(i);
  }
  for (int i = 1; i <= N; i++) cin >> X[i];
  dfs(1);
  cout << "POSSIBLE\n";
  return 0;
}
