#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define Asrt(x) if(!(x)) return !printf("No\n")
#define N 100010
#define lb(x) (x&-x)
#define gc getchar()
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
int a[4][N],b[N],c[5],d[5],p[N],n;
inline int gabs(int x) { return x<0?-x:x; }
inline int update(int x) { for(;x<=n;x+=lb(x)) b[x]^=1;return 0; }
inline int query(int x,int ans=0) { for(;x;x-=lb(x)) ans^=b[x];return ans; }
int main()
{
	n=inn();
	for(int i=1;i<=3;i++)
		for(int j=1;j<=n;j++) a[i][j]=inn();
	for(int i=1;i<=n;i++) Asrt(a[2][i]%3==2);
	for(int i=1;i<=n;i++)
	{
		p[i]=a[2][i]/3+1;
//		debug(i)sp,debug(p[i])ln;
		Asrt(p[i]%2==i%2);
		Asrt(gabs(a[1][i]-a[2][i])==1);
		Asrt(gabs(a[3][i]-a[2][i])==1);
		if(a[1][i]>a[2][i]) c[i&1]^=1;
	}
	for(int i=n;i>=1;i-=2) d[i&1]^=query(p[i]),update(p[i]);
	memset(b,0,sizeof b);
	for(int i=n-1;i>=1;i-=2) d[i&1]^=query(p[i]),update(p[i]);
	Asrt(d[0]==c[1]);Asrt(d[1]==c[0]);return !printf("Yes\n");
}