import java.util.*; import java.awt.geom.*; import java.io.*; import java.math.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int[] in = new int[7]; for(int i = 0; i < 7; i++) { in[i] = sc.nextInt(); } boolean ans = dfs(0,new int[7],new boolean[7],in); if(ans) System.out.println("YES"); else System.out.println("NO"); } static boolean check(int a, int b, int c) { return a != b && b != c && a != c && ((a < b && c < b) || (a > b && c > b)); } static boolean check2(int a, int b, int c) { return check(a,b,c) && a < c; } static boolean check3(int[] a) { for(int i = 0; i < 5; i++) { if(!check2(a[i],a[i+1],a[i+2])) return false; } return true; } static boolean dfs(int id, int[] a, boolean [] b, int[] c) { if(id == 7) return check3(a); for(int i = 0; i < 7; i++) { if(b[i]) continue; b[i] = true; a[id] = c[i]; if(dfs(id+1,a,b,c)) return true; a[id] = 0; b[i] = false; } return false; } }