#include <bits/stdc++.h>

using namespace std;

#define ge getchar()
#define Re read()

inline int read() {
	int x = 0, ch;
	while(!isdigit(ch = ge)) ;
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	return x;
}

int n;
int a[100100][5];
int v[2];

struct BIT {
	int T[100100];

	inline void Add(int p) { while(p <= n) ++T[p], p += p & -p; }
	inline int Query(int p) { int x = 0; while(p) x += T[p], p ^= p & -p; return x; }
}t[2];

int main() { n = Re;
	for(int j = 1; j <= 3; j++)
		for(int i = 1; i <= n; i++)
			a[i][j] = Re;
	for(int i = 1; i <= n; i++) {
		int x = a[i][1];
		v[i & 1] ^= (a[i][1] % 3) ^ 1;
		if((i & 1) != (x & 1)) { puts("No"); return 0; }
		if(x % 3 == 1 && a[i][2] == x + 1 && a[i][3] == x + 2) continue;
		else if(x % 3 == 0 && a[i][2] == x - 1 && a[i][3] == x - 2) continue;
		else { puts("No"); return 0; }
	}
	for(int i = 1; i <= n; i++) {
		int p = (a[i][1] - 1) / 3 + 1; t[i & 1].Add(n - p + 1);
		//	cout << i << ' ' << p << endl;
		if(i - 2 * t[i & 1].Query(n - p) < p) {
			v[(i & 1) ^ 1] ^= ((p - i + 2 * t[i & 1].Query(n - p)) >> 1) & 1;
		}
	}// cout << v[0] << ' ' << v[1] << endl;
	puts(!v[0] && !v[1] ? "Yes" : "No");
	return 0;
}