#include using namespace std; using G=vector>; typedef long long ll; #define rep(i,l,r) for(int i=(l);i<(r);++i) int main(){ int n=3; vector> a(n,vector(n)); rep(i,0,n){string s;cin>>s;rep(j,0,n){a[i][j]=s[j];}} bool flg=true; rep(i,0,n-1){ rep(j,0,n){ if(a[i][j]==a[i+1][j]) flg=false; if(a[i][j]==a[i][j+1]) flg=false; } } cout<<(flg?"Yes":"No")<