import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] input = new String[1]; int i = 0; while (sc.hasNext()) { input[i] = sc.nextLine(); i++; } String[] d = input[0].split(" "); int[] dl = new int[d.length]; for (i = 0; i < d.length; i++) { dl[i] = Integer.valueOf(d[i]); } System.out.println(solve(dl)); sc.close(); } public static String solve(int[] d) { boolean result = false; Arrays.sort(d); int[] c1 = Arrays.copyOfRange(d, 0, d.length); int[] c2 = Arrays.copyOfRange(d, 0, d.length); swap(c1, 0, 1); swap(c1, 2, 3); swap(c1, 4, 4); swap(c2, 1, 2); swap(c2, 3, 4); swap(c2, 5, 6); result = isMatch(c1) || isMatch(c2); return result ? "YES" : "NO"; } private static boolean isMatch(int[] c) { for (int i = 0; i + 2 < c.length; i++) { if (c[0] == c[1] || c[1] == c[2] || c[2] == c[0]) { return false; } if (c[0] > c[2]) { return false; } if ((c[0] < c[1] && c[1] < c[2]) || (c[2] < c[1] && c[1] < c[0])) { return false; } } return true; } private static void swap(int[] c, int i, int j) { int tmp = c[i]; c[i] = c[j]; c[j] = tmp; } }