#int(input()) #map(int, input().split()) #list(map(int, input().split())) def NAND(a, b): return -(a & b) + 1 def f(x): return NAND(NAND(NAND(x[0], x[1]), x[2]), NAND(NAND(x[3], x[4]), x[5])) A = list(input().split()) a = [0] * 6 for i in range(6): a[i] = A.index(A[i]) ans = 0 for i in range(1 << 6): b = format(i, "06b") u = [0] * 6 for j in range(6): u[j] = int(b[a[j]]) if f(u): ans = 1 break if ans == 1: print("YES") else: print("NO")