def nand(x, y): if x == y == 1: return 0 else: return 1 N = 6 A = list(map(int, input().split())) B = A ANS = 'NO' for i in range(N): for j in range(N): if A[i] == B[j]: A[i] = j break for p in range(1<>i)&1) if nand(nand(nand(P[A[0]], P[A[1]]), P[A[2]]), nand(nand(P[A[3]], P[A[4]]), P[A[5]])): ANS = 'YES' print(ANS)