#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    Int N;
    vector<vector<Int>> tree;
    vector<Int> X;

    pair<Int, Int> dfs(Int v, Int p = -1) {
        if (v != 0 && tree[v].size() == 1) {
            return make_pair(X[v], 0ll);
        }

        vector<pair<Int, Int>> ab;
        Int sum = 0;
        for (auto e : tree[v]) {
            if (e != p) {
                pair<Int, Int> tmp = dfs(e, v);
                if (tmp.first == -1 || tmp.second == -1) {
                    return make_pair(-1, -1);
                }
                sum += tmp.first + tmp.second;
                ab.push_back(tmp);
            }
        }

        vector<bool> dp(5001);
        if (!ab.empty()) {
            if (ab.back().first < dp.size()) {
                dp[ab.back().first] = true;
            }
            if (ab.back().second < dp.size()) {
                dp[ab.back().second] = true;
            }
            ab.pop_back();
        }

        for (auto e : ab) {
            vector<bool> ndp(5001);
            for (int i = dp.size() - 1; i >= 0; --i) {
                if (dp[i] && i + e.first < dp.size()) {
                    ndp[i + e.first] = true;
                }
                if (dp[i] && i + e.second < dp.size()) {
                    ndp[i + e.second] = true;
                }
            }
            dp = ndp;
        }

        Int max_f = -1;
        for (int i = 0; i <= X[v]; ++i) {
            if (dp[i]) max_f = i;
        }

        if (max_f == -1) {
            return make_pair(-1, -1);
        }

        pair<Int, Int> ret(X[v], sum - max_f);
        return ret;
    }


    void solve() {
        cin >> N;
        tree.resize(N);
        X.resize(N);
        for (int i = 1; i < N; ++i) {
            Int a, b;
            a = i;
            cin >> b;
            b--;
            tree[a].push_back(b);
            tree[b].push_back(a);
        }
        for (int i = 0; i < N; ++i) cin >> X[i];

        if (N == 1) {
            cout << "POSSIBLE" << endl;
            return;
        }

        auto tapi = dfs(0);
//        if ((tapi.first <= X[0] || tapi.second <= X[0]) && (tapi.first != -1 && tapi.second != -1)) {
        if (tapi.first != -1 && tapi.second != -1) {
            cout << "POSSIBLE" << endl;
        } else {
            cout << "IMPOSSIBLE" << endl;
        }


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 384