import java.util.ArrayList; import java.util.Arrays; import java.util.List; 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); List t = new ArrayList<>(); for (int dd : d) { t.add(dd); } List> candidate = getPermulation(t); // System.out.println(candidate.size()); for (List c : candidate) { if(isMatch(toArr(c))){ return "YES"; } } return "NO"; } private static int[] toArr(List c) { int[] r = new int[c.size()]; for (int i = 0; i < c.size(); i++) { r[i] = c.get(i); } return r; } public static List> getPermulation(List d) { int LL = d.size(); List> ret = new ArrayList>(); if (LL == 1) { ret.add(d); } else { for (int i = 0; i < LL; i++) { List r = new ArrayList<>(d); int keep = r.remove(i); List> rr = getPermulation(r); for (int k = 0; k < rr.size(); k++) { rr.get(k).add(keep); } ret.addAll(rr); } } return ret; } 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]) && ((c[1] < c[0] && c[1] < c[2]) || (c[1] > c[0] && c[1] > c[2]))) { continue; } else { return false; } // 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; } }