#include <bits/stdc++.h>
using namespace std;
inline void proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline T read() {
  register T sum(0), fg(1);
  register char ch(getchar());
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fg = -1;
  for (; isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
  return sum * fg;
}
const int MAXN = (int)1e3, MAXM = (int)5e3;
int n;
vector<int> adj[MAXN + 5];
int w[MAXN + 5];
inline void input() {
  n = read<int>();
  for (int i = 2; i <= n; ++i) {
    int fa = read<int>();
    adj[fa].push_back(i);
  }
  for (int i = 1; i <= n; ++i) w[i] = read<int>();
}
const int INF = (int)1e9;
int M, f[MAXN + 5];
inline void dfs(int u) {
  for (auto v : adj[u]) dfs(v);
  static int g[MAXN + 5];
  for (int i = 0; i <= w[u]; ++i) g[i] = INF;
  g[0] = 0;
  for (auto v : adj[u]) {
    static int res[MAXN + 5];
    for (int i = 0; i <= w[u]; ++i) res[i] = INF;
    for (int i = 0; i <= w[u]; ++i) {
      if (i + f[v] <= w[u]) chkmin(res[i + f[v]], g[i] + w[v]);
      if (i + w[v] <= w[u]) chkmin(res[i + w[v]], g[i] + f[v]);
    }
    for (int i = 0; i <= w[u]; ++i) g[i] = res[i];
  }
  f[u] = INF;
  for (int i = 0; i <= w[u]; ++i) chkmin(f[u], g[i]);
}
inline void solve() {
  M = w[1];
  dfs(1);
  puts(f[1] < INF ? "POSSIBLE" : "IMPOSSIBLE");
}
int main() {
  input();
  solve();
  return 0;
}
