#include #include #include #include #include #include #include #include #include using namespace std; #define ll long long int #define tiii tuple #define pii pair int main() { vector vs(7); for(int i = 0;i < 7;i++) { cin >> vs[i]; } cout << "YES" << endl; return 0; do{ bool ok = true; for(int i = 0;i < 5;i++) { int left = vs[i]; int middle = vs[i + 1]; int right = vs[i + 2]; if(left < right) { if(middle < left && middle < right) { //ok } else if(middle > left && middle > right) { //ok } else { ok = false; break; } } else { ok = false; break; } } if(ok) { cout << "YES" << endl; return 0; } }while(next_permutation(vs.begin(), vs.end())); cout << "NO" << endl; return 0; }