#include <bits/stdc++.h> using namespace std; using ll=long long; using ld=long double; using P=pair<ll,ll>; using V=vector<ll>; #define rep(i,n) for(ll i=0;i<n;i++) #define REP(i,n) for(ll i=1;i<=n;i++) int nd(int x,int y){ if(x&&y) return 0; else return 1; } int main(){ vector<string> s(6),t; rep(i,6) cin >> s[i]; t=s; sort(t.begin(),t.end()); V a(6); rep(i,6) rep(j,6) if(s[i]==t[j]) a[i]=j; bool flag=false; rep(i,64){ V b(6); rep(j,6) b[j]=(i>>a[j])&1; if(nd(nd(nd(b[0],b[1]),b[2]),nd(nd(b[3],b[4]),b[5]))) flag=true; } if(flag) cout << "YES" << endl; else cout << "NO" << endl; }