#pragma GCC optimize(3)
#include<cstdio>
int n,t,a[100005][5],pos[100005],res[2];
char ch[2000005],*p=ch;
inline int rd(){register int res=0;while(*p<'0'||*p>'9'){p++;}while(*p>='0'&&*p<='9'){res=res*10+*p-'0';p++;}return res;}
int main(){
	fread(ch,2000000,1,stdin);n=rd();for(int i=1;i<=3;i++)for(int j=1;j<=n;j++)a[j][i]=rd();
	for(int i=1;i<=n;i++){
		pos[i]=a[i][2]/3+1;
		if(a[i][2]%3-2||(i-pos[i])&1||!((a[i][1]-a[i][2]==1&&a[i][2]-a[i][3]==1)||(a[i][1]-a[i][2]==-1&&a[i][2]-a[i][3]==-1)))return puts("No"),0;
		res[i&1]^=a[i][1]>a[i][2];
	}
	for(int i=1;i<=n;i++)while(pos[i]^i)res[(i&1)^1]^=1,t=pos[pos[i]],pos[pos[i]]=pos[i],pos[i]=t;
	return puts(res[0]+res[1]?"No":"Yes"),0;
}