#include <bits/stdc++.h>
using namespace std;
int n, p[1001], a[1001], d[1001];
vector<int> v[1001];
void dfs(int x) {
  if (v[x].size() == 0) return;
  int dp[a[x] + 1][2];
  memset(dp, 63, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 0; i < v[x].size(); i++) {
    int u = v[x][i];
    for (int i = a[x] - a[u]; i >= 0; i--)
      dp[i + a[u]][1] = min(dp[i + a[u]][1], dp[i][0] + d[u]);
    for (int i = a[x] - d[u]; i >= 0; i--)
      dp[i + d[u]][1] = min(dp[i + d[u]][1], dp[i][0] + a[u]);
    for (int i = 0; i <= a[x]; i++) dp[i][0] = dp[i][1], dp[i][1] = 1 << 30;
  }
  int mn = 1 << 30;
  for (int i = 1; i <= a[x]; i++) mn = min(mn, dp[i][0]);
  d[x] = mn;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) cin >> p[i], v[p[i]].push_back(i);
  for (int i = 1; i <= n; i++) cin >> a[i];
  dfs(1);
  if (d[1] < (1e9))
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
