#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
ostream& operator<<(ostream& out, const vector<T>& arr) {
  cout << "{";
  for (int i = 0; i < arr.size(); i++) cout << (!i ? "" : ", ") << arr[i];
  cout << "}";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const vector<vector<T> >& arr) {
  cout << "{\n";
  for (auto& vec : arr) cout << "  " << vec << ",\n";
  cout << "}";
  return out;
}
template <class T>
istream& operator>>(istream& in, vector<T>& arr) {
  for (auto& i : arr) cin >> i;
  return in;
}
int n;
vector<int> g[1010];
ll X[1010];
void read() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    g[p].push_back(i);
  }
  for (int i = 0; i < n; i++) cin >> X[i];
}
ll dp[5050];
int dfs(int x, int pre) {
  vector<vector<ll> > dp2(2, vector<ll>(5050, 1e9));
  dp2[0][0] = 0;
  for (int i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    ll a = X[v], b = dfs(v, x);
    for (int j = 0; j <= X[x]; j++) {
      if (j + a <= X[x])
        (dp2[(i % 2) ^ 1][j + a]) =
            min((dp2[(i % 2) ^ 1][j + a]), (dp2[i % 2][j] + b));
      if (j + b <= X[x])
        (dp2[(i % 2) ^ 1][j + b]) =
            min((dp2[(i % 2) ^ 1][j + b]), (dp2[i % 2][j] + a));
    }
  }
  ll res = 1e9;
  for (int i = 0; i <= X[x]; i++) (res) = min((res), (dp2[g[x].size() % 2][i]));
  if (res == 1e9) {
    cout << "IMPOSSIBLE" << '\n';
    exit(0);
  } else {
    return dp[x] = res;
  }
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  read();
  dfs(0, -1);
  cout << "POSSIBLE" << '\n';
}
