#include<bits/stdc++.h>
// #include<atcoder/all>
// #include<boost/multiprecision/cpp_int.hpp>

using namespace std;
// using namespace atcoder;
// using bint = boost::multiprecision::cpp_int;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007
// #define MOD 998244353

bool f(bool a,bool b){
  if(a && b)return false;
  return true;
}

int main(){
  
  vector<int> a(6);
  int ggg = 0;
  map<string,int> mp;
  rep(i,6){
    string s;cin >> s;
    if(mp.count(s))a[i] = mp[s];
    else {
      a[i] = ggg;
      mp[s] = ggg;
      ggg++;
    }
  }
  for(int bit = 0;bit < (1 << 6);bit++){
    vector<bool> is(6,0);
    rep(i,6)if(bit >> i & 1){
      rep(j,6)if(a[j] == i){
        is[j] = 1;
      }
    }
    bool ok = f(f(is[0],is[1]),is[2]);
    ok = f(ok,f(f(is[3],is[4]),is[5]));
    if(ok){
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  

  return 0;
}