AB = [list(map(int, input().split())) for _ in range(3)]

g = [[] for _ in range(4)]
for a, b in AB:
	a, b = a - 1, b - 1
	g[a] += [b]
	g[b] += [a]

def dfs(v, p, visited=None):
	if None == visited:
		visited = [False] * 4
	visited[v] = True
	for n in g[v]:
		if visited[n]:
			continue
		if n == p:
			continue
		return dfs(n, v, visited)
	return all(visited)

#print([dfs(x, -1) for x in range(4)])
print(["YES", "NO"][not(any([dfs(x, -1) for x in range(4)]))]) list(map(int, input().split())) for _ in range(3) for _ in range(3) _ range(3) range 3 for _ in range(3) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split AB = [list(map(int, input().split())) for _ in range(3)] AB [list(map(int, input().split())) for _ in range(3)] [] for _ in range(4) for _ in range(4) _ range(4) range 4 for _ in range(4) [] g = [[] for _ in range(4)] g [[] for _ in range(4)] for a, b in AB:
	a, b = a - 1, b - 1
	g[a] += [b]
	g[b] += [a] a b AB a, b = a - 1, b - 1 a a - 1 a 1 b b - 1 b 1 g[a] += [b] g[a] g a [b] b g[b] += [a] g[b] g b [a] a def dfs(v, p, visited=None):
	if None == visited:
		visited = [False] * 4
	visited[v] = True
	for n in g[v]:
		if visited[n]:
			continue
		if n == p:
			continue
		return dfs(n, v, visited)
	return all(visited)

#print([dfs(x, -1) for x in range(4)]) dfs if None == visited:
		visited = [False] * 4
	 None == visited None visited visited = [False] * 4 visited [False] * 4 [False] False 4 visited[v] = True visited[v] visited v True for n in g[v]:
		if visited[n]:
			continue
		if n == p:
			continue
		return dfs(n, v, visited)
	 n g[v] g v if visited[n]:
			continue
		 visited[n] visited n continue if n == p:
			continue
		 n == p n p continue return dfs(n, v, visited) dfs(n, v, visited) dfs n v visited return all(visited) all(visited) all visited v v p p visited=None visited None dfs(x, -1) for x in range(4) for x in range(4) x range(4) range 4 for x in range(4) dfs(x, -1) dfs x -1 print(["YES", "NO"][not(any([dfs(x, -1) for x in range(4)]))]) print ["YES", "NO"][not(any([dfs(x, -1) for x in range(4)]))] ["YES", "NO"] "YES" "NO" not(any([dfs(x, -1) for x in range(4)])) any([dfs(x, -1) for x in range(4)]) any [dfs(x, -1) for x in range(4)] AB = [list(map(int, input().split())) for _ in range(3)] [list(map(int, input().split())) for _ in range(3)] AB def dfs(v, p, visited=None):
	if None == visited:
		visited = [False] * 4
	visited[v] = True
	for n in g[v]:
		if visited[n]:
			continue
		if n == p:
			continue
		return dfs(n, v, visited)
	return all(visited)

#print([dfs(x, -1) for x in range(4)]) def dfs(v, p, visited=None):
	if None == visited:
		visited = [False] * 4
	visited[v] = True
	for n in g[v]:
		if visited[n]:
			continue
		if n == p:
			continue
		return dfs(n, v, visited)
	return all(visited)

#print([dfs(x, -1) for x in range(4)]) dfs b = a - 1, b - 1 b - 1 b g = [[] for _ in range(4)] [[] for _ in range(4)] g a, b = a - 1, b - 1 a - 1 a
AB = [list(map(int, input().split())) for _ in range(3)]

g = [[] for _ in range(4)]
for a, b in AB:
	a, b = a - 1, b - 1
	g[a] += [b]
	g[b] += [a]

def dfs(v, p, visited=None):
	if None == visited:
		visited = [False] * 4
	visited[v] = True
	for n in g[v]:
		if visited[n]:
			continue
		if n == p:
			continue
		return dfs(n, v, visited)
	return all(visited)

#print([dfs(x, -1) for x in range(4)])
print(["YES", "NO"][not(any([dfs(x, -1) for x in range(4)]))])
