#include using namespace std; bool isKadomatsu(long long x, long long y, long long z) { if (x == y || y == z || x == z) return false; if (x > y && y < z && x < z) return true; if (x < y && y > z && x < z) return true; return false; } bool solve() { vector a(7); for (int i = 0; i < 7; i++) { cin >> a[i]; } sort(a.begin(), a.end()); do { bool all = true; for (int i = 0; i < 5; i++) { all &= isKadomatsu(a[i], a[i + 1], a[i + 2]); } if (all) return true; } while (next_permutation(a.begin(), a.end())); return false; } int main() { cout << (solve() ? "YES" : "NO") << endl; }