#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "sz:" << v.size() << "\n[";
  for (const auto& p : v) {
    os << p << ",";
  }
  os << "]\n";
  return os;
}
template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
constexpr ll MOD = (ll)1e9 + 7LL;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;
struct Graph {
  Graph(const int n) { edge.resize(n); }
  void addEdge(const int from, const int to) { edge[from].push_back(to); }
  vector<vector<int>> edge;
};
void dp_dfs(const Graph& g, const int s, const vector<int>& X, vector<int>& Y) {
  unordered_map<int, int> dp;
  bool first = true;
  for (const int to : g.edge[s]) {
    if (first) {
      if (X[to] <= X[s]) {
        dp[X[to]] = Y[to];
      }
      if (Y[to] <= X[s]) {
        dp[Y[to]] = X[to];
      }
      first = false;
    } else {
      for (const auto& e : dp) {
        if (e.first + X[to] <= X[s]) {
          const int v = e.first + X[to];
          if (dp.find(v) != dp.end()) {
            dp[v] = min(dp[v], e.second + Y[to]);
          } else {
            dp[v] = e.second + Y[to];
          }
        }
        if (e.first + Y[to] <= X[s]) {
          const int v = e.first + Y[to];
          if (dp.find(v) != dp.end()) {
            dp[v] = min(dp[v], e.second + X[to]);
          } else {
            dp[v] = e.second + X[to];
          }
        }
      }
    }
  }
  int mini = INF<int>;
  for (const auto& e : dp) {
    if (e.first == 0) {
      continue;
    }
    mini = min(mini, e.second);
  }
  Y[s] = mini;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  Graph g(N);
  for (int i = 1; i < N; i++) {
    int from;
    cin >> from;
    from--;
    g.addEdge(from, i);
  }
  vector<int> X(N);
  for (int i = 0; i < N; i++) {
    cin >> X[i];
  }
  if (N == 1) {
    cout << "POSSIBLE" << endl;
    return 0;
  }
  vector<int> Y(N, 0);
  dp_dfs(g, 0, X, Y);
  if (Y[0] == INF<int>) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << "POSSIBLE" << endl;
  }
  return 0;
}
