/*
    abcde->CBAde->CBEDa->ebcDa->ebAdC->aBcDe
    ->adCbe->cDAbe->cBade->AbCde
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
int n, a[N][3], p[N], t[2];
bool Check() {
    for (int i = 1; i <= n; i++) {
        p[i] = a[i][1] / 3 + 1;
        if (!(a[i][1] - a[i][0] == 1 && a[i][2] - a[i][1] == 1 &&
                  a[i][0] % 3 == 1 ||
              a[i][0] - a[i][1] == 1 && a[i][1] - a[i][2] == 1 &&
                  a[i][2] % 3 == 1))
            return 0;
        if (abs(i-p[i])&1) return 0; 
        t[i & 1] ^= (a[i][0] > a[i][2]);
    }
    for (int i = 1; i <= n; i++) {
        while (p[i] != i) {
            t[i & 1 ^ 1] ^= 1;
            swap(p[i], p[p[i]]);
        }
    }
    return !t[0] && !t[1];
}
int main() {
    scanf("%d", &n);
    for (int k = 0; k < 3; k++) {
        for (int i = 1; i <= n; i++) {
            scanf("%d", &a[i][k]);
        }
    }
    if (Check())
        puts("Yes");
    else
        puts("No");
    return 0;
}