#include <bits/stdc++.h>
using namespace std;
template <typename T>
using v2 = vector<vector<T>>;
template <typename T>
using v3 = vector<vector<vector<T>>>;
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &elemnt : v) is >> elemnt;
  return is;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const long long INFLL = 2e18 + 200;
int main() {
  int N;
  cin >> N;
  vector<vector<int>> graph(N);
  vector<int> parent(N);
  queue<int> explore;
  vector<bool> check(N);
  for (int i = 1; i < N; i++) {
    int temp;
    cin >> temp;
    temp--;
    parent[i] = temp;
    graph[temp].push_back(i);
    graph[i].push_back(temp);
  }
  for (int i = 1; i < N; i++)
    if (graph[i].size() == 1) {
      explore.push(i);
      check[i] = true;
    }
  vector<int> X(N);
  cin >> X;
  vector<pair<int, int>> info(N, {INF, INF});
  while (!explore.empty()) {
    int now = explore.front();
    explore.pop();
    vector<vector<int>> dp(graph[now].size() + 1, vector<int>(6000, INF));
    dp[0][0] = 0;
    int idx = 0;
    for (int next : graph[now]) {
      if (next == parent[now]) continue;
      for (int i = 0; i + X[next] <= 5000; i++) {
        chmin(dp[idx + 1][i + X[next]], dp[idx][i] + info[next].second);
      }
      for (int i = 0; i + info[next].first <= 5000; i++) {
        chmin(dp[idx + 1][i + info[next].first], dp[idx][i] + X[next]);
      }
      idx++;
    }
    for (int i = 0; i <= X[now]; i++) chmin(info[now].second, dp[idx][i]);
    for (int i = 0; i <= 5000; i++) {
      int &temp = dp[idx][i];
      if (temp <= X[now]) {
        info[now].first = i;
        break;
      }
    }
    if (info[now].first == INF && info[now].second == INF) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
    if (!check[parent[now]]) {
      explore.push(parent[now]);
      check[parent[now]] = true;
    }
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
