#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > path(1001);
vector<int> X;
int dp[1001][2];
bool checked[1001];
int dp2[1001][1001];
bool checked2[1001][1001];
const int INF = 1000000007;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int solve(const int i, int cur, int s) {
  if (checked2[cur][s]) return dp2[cur][s];
  if (cur == -1) return 0;
  int ans = INF;
  for (long long j = 0; j < 2; ++j) {
    if (dp[path[i][cur]][j] <= s) {
      int temp = solve(i, cur - 1, s - dp[path[i][cur]][j]);
      if (temp < 0) continue;
      chmin(ans, temp + dp[path[i][cur]][1 - j]);
    } else
      continue;
  }
  if (ans == INF) return -1;
  checked2[cur][s] = true;
  return dp2[cur][s] = ans;
}
int check(int i) {
  if (checked[i]) return 1;
  for (auto itr = path[i].begin(); itr != path[i].end(); ++itr) {
    if (check(*itr) == -1) return -1;
  }
  fill((bool*)checked2, (bool*)checked2 + sizeof(checked2) / sizeof(bool),
       false);
  int temp = solve(i, path[i].size() - 1, X[i]);
  if (temp < 0) return -1;
  dp[i][0] = X[i];
  dp[i][1] = temp;
  checked[i] = true;
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  for (long long i = 0; i < n - 1; ++i) {
    int a;
    cin >> a;
    a--;
    path[a].push_back(i + 1);
  }
  for (long long i = 0; i < n; ++i) {
    int a;
    cin >> a;
    X.push_back(a);
  }
  if (check(0) == -1)
    cout << "IMPOSSIBLE\n";
  else
    cout << "POSSIBLE\n";
  return 0;
}
