#include <bits/stdc++.h>
using namespace std;
int n, p[2001], a[2001], d[2001], first;
vector<int> v[2001];
int dp[1001][5005][2];
void dfs(int x) {
  if (v[x].size() == 0 || first) return;
  for (int i = 0; i <= 5000; i++) dp[x][i][1] = 1 << 30;
  for (int i = 0; i < v[x].size(); i++) {
    int u = v[x][i];
    dfs(u);
    for (int i = 5000 - a[u]; i >= 0; i--)
      dp[x][i + a[u]][1] = min(dp[x][i + a[u]][1], dp[x][i][0] + d[u]);
    for (int i = 5000 - d[u]; i >= 0; i--)
      dp[x][i + d[u]][1] = min(dp[x][i + d[u]][1], dp[x][i][0] + a[u]);
    for (int i = 0; i <= 5000; i++)
      dp[x][i][0] = dp[x][i][1], dp[x][i][1] = 1 << 30;
  }
  d[x] = dp[x][a[x]][0];
  if (d[x] > 5000) first = 1;
}
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 (!first)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
