#include <bits/stdc++.h>
using namespace std;
int N, p[1009], x[1009], dp[1009], dp2[5009], dpv[5009];
vector<int> X[1009];
bool flag = false;
void dfs(int pos) {
  for (int i = 0; i < X[pos].size(); i++) dfs(X[pos][i]);
  for (int i = 0; i < 5009; i++) {
    dp2[i] = (1 << 30);
    dpv[i] = (1 << 30);
  }
  dp2[0] = 0;
  for (int i = 0; i < X[pos].size(); i++) {
    for (int j = x[X[pos][i]]; j < 5009; j++) {
      dpv[j] = min(dpv[j], dp2[j - x[X[pos][i]]] + dp[X[pos][i]]);
    }
    for (int j = dp[X[pos][i]]; j < 5009; j++) {
      dpv[j] = min(dpv[j], dp2[j - dp[X[pos][i]]] + x[X[pos][i]]);
    }
    for (int j = 0; j < 5009; j++) {
      dp2[j] = dpv[j];
      dpv[j] = (1 << 30);
    }
  }
  int minx = (1 << 30);
  for (int i = 0; i <= x[pos]; i++) minx = min(minx, dp2[i]);
  dp[pos] = minx;
  if (minx == (1 << 30)) flag = true;
}
int main() {
  cin >> N;
  for (int i = 2; i <= N; i++) {
    cin >> p[i];
    X[p[i]].push_back(i);
  }
  for (int i = 1; i <= N; i++) cin >> x[i];
  dfs(1);
  if (flag == false)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
