#include <bits/stdc++.h>
using namespace std;
using namespace placeholders;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<vector<int> >;
using VS = vector<string>;
using ISS = istringstream;
using OSS = ostringstream;
using PII = pair<int, int>;
using VPII = vector<pair<int, int> >;
template <typename T = int>
using VT = vector<T>;
template <typename T = int>
using VVT = vector<vector<T> >;
template <typename T = int>
using LIM = numeric_limits<T>;
template <typename T>
inline istream &operator>>(istream &s, vector<T> &v) {
  for (T &t : v) {
    s >> t;
  }
  return s;
}
template <typename T>
inline ostream &operator<<(ostream &s, const vector<T> &v) {
  for (int i = 0; i < int(v.size()); ++i) {
    s << (" " + !i) << v[i];
  }
  return s;
}
void in_impl(){};
template <typename T, typename... TS>
void in_impl(T &head, TS &...tail) {
  cin >> head;
  in_impl(tail...);
}
template <typename T>
struct getv_fmt;
template <>
struct getv_fmt<int> {
  static constexpr const char *fmt = "%d";
};
template <>
struct getv_fmt<long long> {
  static constexpr const char *fmt = "%lld";
};
template <typename T>
void getv(std::vector<T> &v) {
  for_each(begin(v), end(v), [](T &a) { scanf(getv_fmt<T>::fmt, &a); });
};
template <typename T>
inline T fromString(const string &s) {
  T res;
  istringstream iss(s);
  iss >> res;
  return res;
}
template <typename T>
inline string toString(const T &a) {
  ostringstream oss;
  oss << a;
  return oss.str();
}
template <typename T>
inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
constexpr int INF = LIM<>::max() / 2;
int N;
VVI G;
VI X;
int dp[1024];
int solve(const int u) {
  int &res = dp[u];
  if (res < INF) {
    return res;
  }
  if (G[u].empty()) {
    return res = 0;
  }
  VI cur(1 << 14, INF), nex(1 << 14, INF);
  cur[0] = 0;
  for (auto &&v : G[u]) {
    if (solve(v) == INF) {
      continue;
    }
    for (int i = (int)(0); i < (int)(X[u] + 1); ++i) {
      chmin(nex[i + X[v]], cur[i] + solve(v));
      chmin(nex[i + solve(v)], cur[i] + X[v]);
    }
    swap(cur, nex);
    fill(begin(nex), end(nex), INF);
  }
  return res = *min_element(begin(cur), begin(cur) + X[u] + 1);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(12) << fixed;
  cin >> N;
  G.resize(N);
  X.resize(N);
  for (int i = (int)(1); i < (int)(N); ++i) {
    int p;
    in_impl(p);
    ;
    G[p - 1].push_back(i);
  }
  cin >> X;
  fill((remove_all_extents<decltype(dp)>::type *)dp,
       (remove_all_extents<decltype(dp)>::type *)dp +
           sizeof(dp) / sizeof(remove_all_extents<decltype(dp)>::type),
       INF);
  cout << (solve(0) < INF ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}
