#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
long long add(long long a, long long b, long long m = 1000000007) {
  long long ret = a + b;
  if (ret >= m) ret -= m;
  return ret;
}
long long subtract(long long a, long long b, long long m = 1000000007) {
  long long ret = a - b;
  if (ret < 0) ret += m;
  return ret;
}
long long mult(long long a, long long b, long long m = 1000000007) {
  long long ret = a * b;
  if (ret >= m) ret %= m;
  return ret;
}
long long bigmod(long long a, long long b, long long m = 1000000007) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = mult(ret, a, m);
    b >>= 1;
    a = mult(a, a, m);
  }
  return ret;
}
long long inverse(long long n, long long m = 1000000007) {
  return bigmod(n, 1000000007 - 2, m);
}
int poss, X[5010], cases, vis[5010][5010], dp[5010][2];
vector<int> e[5010];
int f(int u, int i, int tot) {
  if (poss == 0) return 0;
  if (i == -1) return 1;
  int &ret = dp[i][tot];
  if (vis[i][tot] == cases) return ret;
  vis[i][tot] = cases;
  int v = e[u][i];
  ret = 0;
  if (tot >= dp[v][0] && f(u, i - 1, tot - dp[v][0])) return ret = 1;
  if (tot >= dp[v][1] && f(u, i - 1, tot - dp[v][1])) return ret = 1;
  return ret = 0;
}
void bt(int u, int i, int tot) {
  if (poss == 0) return;
  if (i == -1) {
    dp[u][0] += tot;
    return;
  }
  int v = e[u][i];
  ;
  if (tot >= dp[v][0] && f(u, i - 1, tot - dp[v][0])) {
    ;
    dp[u][0] += dp[v][0];
    dp[u][1] += dp[v][1];
    bt(u, i - 1, tot - dp[v][0]);
    return;
  }
  if (tot >= dp[v][1] && f(u, i - 1, tot - dp[v][1])) {
    ;
    swap(dp[v][0], dp[v][1]);
    dp[u][0] += dp[v][0];
    dp[u][1] += dp[v][1];
    ;
    bt(u, i - 1, tot - dp[v][0]);
  }
}
void dfs(int u) {
  dp[u][0] = dp[u][1] = 0;
  if (poss == 0) return;
  if (e[u].size() == 0) {
    dp[u][0] = X[u], dp[u][1] = 0;
    return;
  }
  for (auto v : e[u]) {
    dfs(v);
  }
  ++cases;
  int ret = f(u, e[u].size() - 1, X[u]);
  if (ret) {
    ;
    bt(u, e[u].size() - 1, X[u]);
    ;
    for (auto v : e[u])
      ;
  } else {
    poss = 0;
    return;
  }
}
int main() {
  int n, x;
  while (scanf("%d", &n) == 1) {
    for (int i = 1; i < n; ++i) {
      scanf("%d", &x);
      --x;
      e[x].push_back(i);
    }
    for (int i = 0; i < n; ++i) scanf("%d", &X[i]);
    poss = 1;
    dfs(0);
    if (poss == 0)
      puts("IMPOSSIBLE");
    else
      puts("POSSIBLE");
    for (int i = 0; i < n; ++i) e[i].clear();
  }
  return 0;
}
