#include #define int long long //#define USE_FREOPEN //#define MUL_TEST #define FILENAME "digit" using namespace std; int a[8]; void solve() { for (int i = 1; i <= 7; i++) cin >> a[i]; sort(a + 1,a + 8); do { for (int i = 1; i <= 5; i++) { if (a[i] < a[i + 2] && (a[i] != a[i + 1] && a[i] != a[i + 2])) { if (a[i] > a[i + 1] || a[i + 1] > a[i + 2]) if (i == 5) { puts("YES"); return; } } else break; } }while(next_permutation(a + 1,a + 8)); puts("NO"); } signed main() { #ifdef USE_FREOPEN freopen(FILENAME ".in","r",stdin); freopen(FILENAME ".out","w",stdout); #endif int _ = 1; #ifdef MUL_TEST cin >> _; #endif while (_--) solve(); _^=_; return 0^_^0; }