#include <bits/stdc++.h>
using namespace std;
string i_s(int x) {
  if (x == 0) return "0";
  string ret = "";
  while (x) {
    ret = ret + (char)(x % 10 + '0');
    x /= 10;
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
string add(string a, string b) {
  if (a == "") a = "0";
  if (b == "") b = "0";
  if (a.length() < b.length()) swap(a, b);
  while (b.length() < a.length()) {
    b = '0' + b;
  }
  for (int i = 0; i < a.length(); i++) {
    a[i] = a[i] + (b[i] - '0');
  }
  bool big = false;
  for (int i = a.length() - 1; i >= 0; i--) {
    if (big) {
      a[i]++;
    }
    big = false;
    if (a[i] > '9') {
      a[i] = a[i] - 10;
      big = true;
    }
  }
  if (big) a = '1' + a;
  return a;
}
string mul(string a, string b) {
  vector<int> va, vb;
  if (a == "0" || b == "0") return "0";
  string ans;
  for (int i = 0; i < a.length(); i++) {
    va.push_back(a[i] - '0');
  }
  for (int i = 0; i < b.length(); i++) {
    vb.push_back(b[i] - '0');
  }
  reverse(va.begin(), va.end());
  reverse(vb.begin(), vb.end());
  vector<int> res;
  res.clear();
  res.resize(1005);
  for (int i = 0; i < a.length(); i++) {
    for (int j = 0; j < b.length(); j++) {
      res[i + j] += (va[i] * vb[j]);
    }
  }
  for (int i = 0; i < 1005; i++) {
    if (res[i] > 9) {
      res[i + 1] += (res[i] / 10);
      res[i] %= 10;
    }
  }
  for (int i = 0; i < 1005; i++) {
    ans += (res[i] + '0');
  }
  reverse(ans.begin(), ans.end());
  int k = 0;
  while (ans[k] == '0') {
    k++;
  }
  ans = ans.substr(k);
  return ans;
}
bool is_prime(int n) {
  if (n < 2) return false;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
int n, m, i, j, dp[1005][5005], dp2[5005], used[1005], x, mx = 1, num[1005],
                                                          vis[1005];
vector<int> bi[1005];
pair<int, int> dfs(int x) {
  int i, j;
  for (i = 0; i < bi[x].size(); i++) {
    pair<int, int> nxt = dfs(bi[x][i]);
    fill(dp2, dp2 + 5005, 0x3f3f3f3f);
    for (j = 5000 - nxt.second; j >= 0; j--) {
      dp2[j + nxt.second] = min(dp2[j + nxt.second], dp[x][j] + nxt.first);
    }
    for (j = 5000 - nxt.first; j > 0; j--) {
      dp2[j + nxt.first] = min(dp2[j + nxt.first], dp[x][j] + nxt.second);
    }
    for (j = 0; j <= 5000; j++) {
      dp[x][j] = dp2[j];
    }
    j++;
    j--;
    j++;
    j--;
  }
  return pair<int, int>{num[x], dp[x][num[x]]};
}
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];
  if (dfs(1).second == 0x3f3f3f3f) {
    cout << "IMPOSSIBLE";
    return 0;
  }
  cout << "POSSIBLE";
  return 0;
}
