#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, dp[1005], used[1005], x, mx = 1, num[1005], vis[1005];
vector<int> bi[1005];
void dfs(int x) {
  if (vis[x]) return;
  vis[x] = 1;
  int i;
  mx = max(mx, num[x]);
  dp[x] = 0;
  for (i = 0; i < bi[x].size(); i++) {
    dfs(bi[x][i]);
    dp[x] = max(max(dp[x], dp[bi[x][i]]), num[bi[x][i]]);
  }
}
void dfs2(int x, int y) {
  if (vis[x]) return;
  vis[x] = 1;
  int i;
  if (num[x] == y) {
    used[x] = 1;
    y = dp[x];
  }
  for (i = 0; i < bi[x].size(); i++) {
    dfs2(bi[x][i], y);
  }
}
bool dfs3(int x, int lst) {
  if (vis[x]) return 1;
  if (!used[x] && num[x] > lst) return 0;
  if (!used[x] && num[x] <= lst) lst = num[x];
  vis[x] = 1;
  int i;
  for (i = 0; i < bi[x].size(); i++) {
    if (!dfs3(bi[x][i], lst)) return 0;
  }
  return 1;
}
int main() {
  cin >> n;
  for (i = 2; i <= n; i++) {
    cin >> x;
    bi[x].push_back(i);
  }
  for (i = 1; i <= n; i++) cin >> num[i];
  dfs(1);
  memset(vis, 0, sizeof(vis));
  dfs2(1, mx);
  memset(vis, 0, sizeof(vis));
  if (!dfs3(1, 1 << 30)) cout << "IM";
  cout << "POSSIBLE";
  return 0;
}
