#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1000 + 5;
int N;
int X[NMAX];
vector<int> graph[NMAX];
pair<int, int> p[NMAX];
int dp[5005];
void updMin(int &where, int val) {
  if (val < where) where = val;
}
void dfs(int node) {
  for (auto it : graph[node]) dfs(it);
  for (int i = 0; i <= 5001; ++i) dp[i] = 1E9 + 256;
  dp[0] = 0;
  for (auto it : graph[node]) {
    int a = p[it].first, b = p[it].second;
    for (int val = 5001; val >= 0; --val) {
      int x = dp[val];
      dp[val] = 1E9 + 256;
      updMin(dp[val + a], min(5001, x + b));
      updMin(dp[val + b], min(5001, x + a));
    }
  }
  p[node].first = X[node];
  p[node].second = 1E9 + 256;
  for (int i = 0; i <= X[node]; ++i)
    p[node].second = min(p[node].second, dp[i]);
  if (p[node].second >= 1E9 / 2) {
    cout << "IMPOSSIBLE\n";
    exit(0);
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin >> N;
  for (int i = 2; i <= N; ++i) {
    int p;
    cin >> p;
    graph[p].push_back(i);
  }
  for (int i = 1; i <= N; ++i) cin >> X[i];
  dfs(1);
  cout << "POSSIBLE\n";
  return 0;
}
