#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <utility>
#include <functional>
#include <algorithm>

int main() {
    long long n, t;
    std::cin >> n;
    std::vector<long long> p(n), x(n);
    std::vector<std::deque<long long>> c(n);
    for (auto i = 1ll; i < n; i++) {
        std::cin >> t;
        t--;
        p[i] = t;
        c[t].push_back(i);
    }
    for (auto i = 0ll; i < n; i++) std::cin >> x[i];

    std::deque<long long> q, q2;
    q.push_back(0);
    q2.push_back(0);
    while (!q2.empty()) {
        auto curr = q2.front();
        for (auto el : c[curr]) {
            q.push_back(el);
            q2.push_back(el);
        }
        q2.pop_front();
    }

    std::vector<std::pair<long long, long long>> costs(n);
    while (!q.empty()) {
        auto curr = q.back();
        q.pop_back();
        auto chsum = 0ll, othersum = 0ll;
        if (c[curr].size() == 0) {
            costs[curr] = { x[curr], 0 };
            continue;
        }
        for (auto ch : c[curr]) {
            chsum += costs[ch].second;
            othersum += costs[ch].first;
        }
        if (chsum > x[curr]) {
            std::cout << "IMPOSSIBLE" << std::endl;
            return 0;
        }
        std::multiset<long long, std::greater<>> candidates;
        for (auto ch : c[curr]) {
            auto diff = costs[ch].first - costs[ch].second;
            if (diff >= x[curr] - chsum) candidates.insert(diff);
        }
        while (!candidates.empty() && chsum + *candidates.begin() <= x[curr]) {
            chsum += *candidates.begin();
            othersum -= *candidates.begin();
            candidates.erase(candidates.begin());
        }
        costs[curr] = { std::max(x[curr], othersum), std::min(x[curr], othersum) };
    }

    std::cout << "POSSIBLE" << std::endl;

    return 0;
}