#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
long double pi = 3.1415926535897932384626433832795;
long long mod = 1e9 + 7;
const int N = 1e5 + 10;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int a[5555][5555], sz[1111], other[1111], n, x[1111];
vector<int> g[1111];
bool dfs(int v, int p = -1) {
  a[v][0] = 1;
  vector<int> pos;
  pos.push_back(0);
  bool ok = 1;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (to == p) continue;
    ok &= dfs(to, v);
    if (!ok) return ok;
    sz[v] += sz[to];
    vector<int> pos1 = pos;
    for (int j = 0; j < pos.size(); j++) {
      int p = pos[j];
      if (p + x[to] <= x[v]) {
        if (a[v][p + x[to]] == 0)
          pos1.push_back(p + x[to]), a[v][p + x[to]] = 1;
      }
      int np = p + sz[to] - x[to];
      if (np <= x[v]) {
        if (a[v][np] == 0) pos1.push_back(np), a[v][np] = 1;
      }
    }
  }
  sz[v] += x[v];
  return ok;
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u = i + 1, v;
    cin >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) cin >> x[i];
  bool ok = dfs(1);
  if (!ok) cout << "IM";
  cout << "POSSIBLE";
  return 0;
}
