#include <iostream>
#include <algorithm>
#include <vector>

int max3(int a, int b, int c){
    return std::max(a, std::max(b, c));
}
int min3(int a, int b, int c){
    return std::min(a, std::min(b, c));
}
bool diff3(int a, int b, int c){
    return (a!=b && b!=c && c!=a);
}
bool isZoukaKadomatsu(int a, int b, int c){
    return (diff3(a, b, c) && a<c && (b==max3(a, b, c) || b==min3(a, b, c)));
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    
    std::vector<int> d(7);
    for(auto& i : d){
        std::cin >> i;
    }
    std::sort(d.begin(), d.end());
    do{
        bool flag=true;
        for(int i=0; i<5; ++i){
            if(!isZoukaKadomatsu(d[i], d[i+1], d[i+2])){
                flag=false;
                break;
            }
        }
        if(flag){
            std::cout << "YES\n";
            return 0;
        }
    }while(std::next_permutation(d.begin(), d.end()));
    std::cout << "NO\n";
    return 0;
}