program main
integer(8)::a(4),i,c,j,p
	read*,a
	do j = 1,4
		c =0
		p = (j-1)*3+1
		if (p == 10) p = 9
		do i = 1,4
			if(a(i) == p) c = 1
		enddo
		if(c == 0)then
			print "(a)","NO"
			stop
		endif
	enddo
	
	print"(a)","YES"

end program main