#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e5+500;
int n,a[5][N],rev[3],tmp[N],pos[N*3];
struct BIT
{
    int a[N];
    void clear(){for(int i=1;i<=n;i++)a[i]=0;}
    void update(int x,int w){for(;x<=n;x+=x&-x)a[x]+=w;}
    int query(int x){int ans=0;for(;x;x-=x&-x)ans+=a[x];return ans;}
    int query(int l,int r){if(l>r)return 0;return query(r)-query(l-1);}
}s[2];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=3;i++)
        for(int j=1;j<=n;j++)scanf("%d",&a[i][j]);
    for(int i=1;i<=n;i++)tmp[i]=a[2][i];
    sort(tmp+1,tmp+n+1);
    for(int i=1;i<=n;i++)pos[(i-1)*3+2]=i;
    for(int i=1;i<=n;i++)if(tmp[i]!=(i-1)*3+2){puts("No");return 0;}
    for(int i=1;i<=n;i++)
    {
        int u=a[1][i],v=a[3][i];if(u>v)swap(u,v),rev[i&1]^=1;
        if(u+1!=a[2][i]||v-1!=a[2][i]){puts("No");return 0;}
        if((pos[a[2][i]]&1)!=(i&1)){puts("No");return 0;}
        rev[~i&1]^=s[i&1].query(pos[a[2][i]]+1,n)&1;
        s[i&1].update(pos[a[2][i]],1);
    }
    if(rev[0]||rev[1]){puts("No");return 0;}
    puts("Yes");return 0;
}