#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#pragma warning (disable: 4996)

int bit[100009];

void add(int pos, int x) {
	pos++;
	while (pos <= 100008) { bit[pos] += x; pos += (pos&-pos); }
}
int sum(int pos) {
	pos++; int s = 0;
	while (pos >= 1) { s += bit[pos]; pos -= (pos&-pos); }
	return s;
}

long long solve(vector<int>A) {
	for (int i = 0; i < 100009; i++) bit[i] = 0;
	long long ret = 0;
	for (int i = 0; i < A.size(); i++) {
		ret += sum(100005) - sum(A[i]);
		add(A[i], 1);
	}
	return ret;
}

int N, A[3][100009], C[100009]; bool U[100009];

int main() {
	cin >> N;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < N; j++) cin >> A[i][j];
	}
	for (int i = 0; i < N; i++) {
		int minx = min({ A[0][i], A[1][i], A[2][i] });
		if (minx % 3 != 1) {
			cout << "No" << endl;
			return 0;
		}
		if (A[0][i] == minx && A[1][i] == minx + 1 && A[2][i] == minx + 2) { C[i] = minx / 3; U[i] = false; }
		else if (A[0][i] == minx + 2 && A[1][i] == minx + 1 && A[2][i] == minx) { C[i] = minx / 3; U[i] = true; }
		else {
			cout << "No" << endl;
			return 0;
		}
	}
	vector<int>vec1, vec2; long long G1 = 0, G2 = 0;
	for (int i = 0; i < N; i += 2) { vec1.push_back(C[i]); if (U[i] == true) G1++; }
	for (int i = 1; i < N; i += 2) { vec2.push_back(C[i]); if (U[i] == true) G2++; }
	for (int i = 0; i < vec1.size(); i++) {
		if (vec1[i] % 2 == 1) { cout << "No" << endl; return 0; }
	}
	for (int i = 0; i < vec2.size(); i++) {
		if (vec2[i] % 2 == 0) { cout << "No" << endl; return 0; }
	}
	long long v1 = solve(vec1);
	long long v2 = solve(vec2);

	// 1 -> 2 の場合
	if ((G1 + v2) % 2 == 0 && (G2 + v1) % 2 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}