One day *n* cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move *i*-th cell can exchange it's value with the value of some other *j*-th cell, if |*i* - *j*| = *d*<sub class="lower-index">*i*</sub>, where *d*<sub class="lower-index">*i*</sub> is a favourite number of *i*-th cell. Cells make moves in any order, the number of moves is unlimited.

The favourite number of each cell will be given to you. You will also be given a permutation of numbers from 1 to *n*. You are to determine whether the game could move to this state.
The first line contains positive integer *n* (1 ≤ *n* ≤ 100) — the number of cells in the array. The second line contains *n* distinct integers from 1 to *n* — permutation. The last line contains *n* integers from 1 to *n* — favourite numbers of the cells.
#include <bits/stdc++.h>
using namespace std;
#define  ll long long 
#define  range(v) ((v).begin()),((v).end())
#define Fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define frac(n) fixed<<setprecision(n)
#define close(n) return cout<<n,0;
ll gcd(ll x, ll y) { if (!y)return x; return gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }
ll fast(ll n, ll p) {
	if (!p)return 1;
	ll res = fast(n, p / 2);
	return (p & 1 ? n * res * res : res * res);
}
template <typename t1, typename t2 >
struct cm {
	bool operator()(const pair<int, int>& a, const pair<int, int>& b)const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb)return a.first < b.first;
		return lena > lenb;
	}
};
bool cmp(pair<int, int>& a, pair<int, int>& b) {
	return (a.first - a.second > b.first - b.second);
}
int a[102], b[102], res[102]{};
int q(int x) { return x == res[x] ? x : q(res[x]); }
void m(int i, int j) { res[q(i)] = q(j); }
int main()
{
	int T = 1;
	//cin >> T;
	for (int h = 1; h <= T; h++) {
		int size;
		cin >> size;
		for (int i = 1; i <= size; i++)cin >> a[i],res[i]=i;
		for (int i = 1; i <= size; i++) {
			cin >> b[i];
			if (b[i] + i <= size)m(i, i + b[i]);
			if (i > b[i])m(i, i - b[i]);
		}
		for (int i = 1; i <= size; i++) {
			if (q(i) != q(a[i]))close("NO");
		}
		cout << "YES\n";
	}
}