#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<string> a(6);
    vector<string> c;
    for(auto &&s:a){
        cin >> s;
        c.push_back(s);
    }
    auto f = [&](int lhs, int rhs){
        return !(lhs & rhs);
    };
    auto g = [&](vector<int> b){
        return f(f(f(b[0], b[1]), b[2]), f(f(b[3], b[4]), b[5]));
    };
    sort(c.begin(), c.end());
    c.erase(unique(c.begin(), c.end()), c.end());
    for(int i = 0; i < (1 << c.size()); i++){
        vector<int> b(6);
        for(int j = 0; j < a.size(); j++){
            int k = lower_bound(c.begin(), c.end(), a[j]) - c.begin();
            b[j] = (i >> k & 1);
        }
        if(g(b)){
            cout << "YES" << '\n';
            return 0;
        }
    }
    cout << "NO" << '\n';
}