#include "bits/stdc++.h" #define ALL(obj) (obj).begin(),(obj).end() #define RALL(obj) (obj).rbegin(),(obj).rend() #define REP(i, n) for(int i = 0; i < (int)(n); i++) #define REPR(i, n) for(int i = (int)(n); i >= 0; i--) #define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++) using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9 + 6; const ll LLINF = 4e18; bool OK(const vector &d) { REP(i, 5) { if (!(d[i] < d[i + 2] && ((d[i] < d[i + 1] && d[i + 1] > d[i + 2]) || (d[i] > d[i + 1] && d[i + 1] < d[i + 2])))) return false; } return true; } int main() { vector d(7); REP(i, 7) cin >> d[i]; sort(ALL(d)); do { if (OK(d)) { puts("YES"); return 0; } } while (next_permutation(ALL(d))); puts("NO"); getchar(); getchar(); }