#include #include #include #include #include #include #include using namespace std; bool kadomatsu(int a, int b, int c) { if(a == b || b == c || c == a) return false; return (a < b && c < b || a > b && c > b) && a < c; } int main() { cin.tie(0); ios::sync_with_stdio(false); vector D(7); for(int i = 0; i < 7; i++) { cin >> D[i]; } sort(D.begin(), D.end()); do { bool flag = true; for(int i = 0; i <= 4; i++) { if(!kadomatsu(D[i], D[i + 1], D[i + 2])) { flag = false; break; } } if(flag) { cout << "YES" << endl; return 0; } } while(next_permutation(D.begin(), D.end())); cout << "NO" << endl; }