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

using namespace std;

bool is_kadomatsu(int a, int b, int c){
	if(a==b || b==c || c==a) return false;
	if(a<b && b>c) return true;
	if(a>b && b<c) return true;
	return false;
}

int main(){
	int n = 7;
	vector<int> a(n);
	for(int i=0; i<n; i++) cin >> a[i];
	sort(a.begin(), a.end());

	do{
		bool ok = true;
		for(int i=2; i<n; i++){
			if( (is_kadomatsu(a[i-2], a[i-1], a[i]) && a[i-2] < a[i]) == false){
				ok = false;
			}
		}
		if(ok){
			cout << "YES" << endl;
			return 0;
		}
	}while(next_permutation(a.begin(), a.end()));

	cout << "NO" << endl;
	return 0;
}