#include <bits/stdc++.h>
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const long long LINF = 1e18;
using namespace std;
long long n, cnt, ans, a, b, c, d, tmp, tmpp, m, h, w, x[1002], y, sum, pos, k;
long double doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge {
  int to, cost;
};
vector<long long> g[1002];
long long dp[1002];
int mem[1002];
bool vi[1002];
int judge = 1;
void dfs(long long now) {
  if (mem[now] == 0 || vi[now]) return;
  vi[now] = true;
  for (int(i) = 0; (i) < (int)((g[now]).size()); (i)++) {
    dfs(g[now][i]);
  }
  long long tem_dp[1002][5005];
  for (int(i) = 0; (i) < (int)(1002); (i)++) {
    for (int(j) = 0; (j) < (int)(5001); (j)++) {
    }
  }
  for (int(j) = 0; (j) < (int)(5001); (j)++) tem_dp[0][j] = 0;
  for (int i = (1); i < ((g[now]).size() + 1); i++) {
    long long chi = g[now][i - 1];
    for (int j = (x[now]); j >= (0); j--) {
    }
  }
  long long ret = LINF;
  for (int(i) = 0; (i) < (int)(x[now] + 1); (i)++) {
    ret = min(ret, tem_dp[(g[now]).size()][i]);
  }
  if (ret == LINF) judge = 0;
  dp[now] = ret;
  return;
}
int main(void) {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int(i) = 0; (i) < (int)(n - 1); (i)++) {
    cin >> a;
    mem[a - 1] = 1;
    g[a - 1].push_back(i + 1);
  }
  for (int(i) = 0; (i) < (int)(n); (i)++) cin >> x[i];
  dfs(0);
  if (judge == 1)
    cout << ("POSSIBLE") << endl;
  else
    cout << ("IMPOSSIBLE") << endl;
  return 0;
}
