#include <bits/stdc++.h>
using namespace std;
struct edge {
  long long int to, cost;
};
const long long int INF = 1e18;
const long long int MOD = 1e9 + 7;
template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  long long int len = v.size();
  for (long long int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1) s << " ";
  }
  return s;
}
signed main() {
  long long int N;
  cin >> N;
  vector<long long int> pair<long long int, long long int>(N), X(N);
  for (long long int i = (1); i < (N); ++i) {
    cin >> pair<long long int, long long int>[i];
    pair<long long int, long long int>[i]--;
  }
  for (long long int i = (0); i < (N); ++i) {
    cin >> X[i];
  }
  vector<vector<long long int> > G(N, vector<long long int>());
  for (long long int i = (1); i < (N); ++i) {
    G[pair<long long int, long long int>[i]].push_back(i);
  }
  vector<long long int> y(N, INF);
  for (long long int v = (N)-1; v >= (0); --v) {
    vector<vector<long long int> > dp((long long int)((G[v]).size()) + 1,
                                      vector<long long int>(5001, INF));
    long long int x_sum = 0, y_sum = 0;
    for (long long int i = (0); i < ((long long int)((G[v]).size())); ++i) {
      x_sum += X[G[v][i]];
      y_sum += y[G[v][i]];
    }
    dp[0][y_sum] = x_sum;
    for (long long int i = (0); i < ((long long int)((G[v]).size())); ++i) {
      for (long long int j = (0); j < (5001); ++j) {
        if (j - X[G[v][i]] + y[G[v][i]] >= 0) {
          dp[i + 1][j] =
              min(dp[i][j - X[G[v][i]] + y[G[v][i]]] - X[G[v][i]] + y[G[v][i]],
                  dp[i][j]);
        } else {
          dp[i + 1][j] = dp[i][j];
        }
      }
    }
    long long int m = INF;
    for (long long int j = (0); j < (X[v] + 1); ++j) {
      m = min(m, dp[(long long int)((G[v]).size())][j]);
    }
    if (m >= (long long int)(INF * 0.9)) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
    y[v] = m;
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
