#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; bool is_kadomatsu(vi as) { if (as[0] == as[1] || as[1] == as[2] || as[0] == as[2]) return false; return as[1] > max(as[0], as[2]) || as[1] < min(as[0], as[2]); } int main() { vi as(7); for (int i = 0; i < 7; i++) { cin >> as[i]; } sort(as.begin(), as.end()); do { for (int i = 0; i < 5; i++) { if (is_kadomatsu({as[i], as[i + 1], as[i + 2]})) { cout << "YES" << endl; return 0; } } } while (next_permutation(as.begin(), as.end())); cout << "NO" << endl; }