#include <bits/stdc++.h>
using namespace std;
class Problem {
 private:
  int n;
  vector<vector<int>> g;
  vector<int> x;
  bool ispos = true;
  int mxsum(int sum, vector<int> &a) {
    if (a.empty()) {
      return 0;
    }
    vector<vector<bool>> dp(a.size(), vector<bool>(sum + 1, 0));
    dp[0][0] = 1;
    dp[0][a[0]] = 1;
    for (int i = 1; i < a.size(); i++) {
      for (int j = 0; j <= sum; j++) {
        dp[i][j] = dp[i][j] | dp[i - 1][j];
        if (j >= a[i]) {
          dp[i][j] = dp[i][j] | dp[i - 1][j - a[i]];
        }
      }
    }
    for (int i = sum; i >= 0; i--) {
      if (dp[a.size() - 1][i]) {
        return i;
      }
    }
  }
  pair<int, int> dfs(int u, int par) {
    vector<pair<int, int>> ch;
    vector<int> a;
    int val = 0, ans = 0;
    for (int v : g[u]) {
      if (v == par) {
        continue;
      }
      ch.push_back(dfs(v, u));
      a.push_back(ch.back().second - ch.back().first);
      val += ch.back().first;
      ans += ch.back().second;
    }
    if (val > x[u]) {
      ispos = false;
      return {};
    }
    int ret = ans - mxsum(x[u] - val, a);
    return {min(ret, x[u]), max(ret, x[u])};
  }

 public:
  Problem() {
    cin >> n;
    g.resize(n);
    x.resize(n);
    for (int i = 1, par; i < n; i++) {
      cin >> par;
      par--;
      g[i].push_back(par);
      g[par].push_back(i);
    }
    for (int i = 0; i < n; i++) {
      cin >> x[i];
    }
  }
  void solve() {
    dfs(0, -1);
    if (ispos) {
      cout << "POSSIBLE" << endl;
    } else {
      cout << "IMPOSSIBLE" << endl;
    }
    return;
  }
};
int main() {
  Problem pb;
  pb.solve();
  return 0;
}
