#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const long long INFF = 1e18;
int N;
int P[1010], X[1010];
vector<int> G[1010];
int dp[1010][2];
void dfs(int u, int p) {
  int cnt = 0;
  for (auto v : G[u]) {
    if (v == p) continue;
    cnt++;
    dfs(v, u);
    if (dp[v][0] != INF) {
      if (X[u] >= X[v])
        dp[u][0] = (((dp[u][0]) > (dp[v][0])) ? (dp[v][0]) : (dp[u][0]));
      if (X[u] >= dp[v][0])
        dp[u][1] = (((dp[u][1]) > (X[v])) ? (X[v]) : (dp[u][1]));
    }
    if (dp[v][1] != INF) {
      if (X[u] >= dp[v][1])
        dp[u][0] = (((dp[u][0]) > (X[v])) ? (X[v]) : (dp[u][0]));
      if (X[u] >= X[v])
        dp[u][1] = (((dp[u][1]) > (dp[v][1])) ? (dp[v][1]) : (dp[u][1]));
    }
  }
  if (!cnt) {
    dp[u][0] = dp[u][1] = 0;
  }
}
int main(void) {
  cin >> N;
  for (int i = 0; i < (N - 1); i++) cin >> P[i];
  for (int i = 0; i < (N); i++) cin >> X[i];
  for (int i = 0; i < (N - 1); i++) P[i]--;
  for (int i = (1); i < (N); i++) {
    G[i].push_back(P[i - 1]), G[P[i - 1]].push_back(i);
  }
  for (int i = 0; i < (1010); i++)
    for (int j = 0; j < (2); j++) dp[i][j] = INF;
  dfs(0, -1);
  if (dp[0][0] != INF || dp[0][1] != INF)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
