I met this problem as a subproblem many times and tried to find a solution for it but failed ,So I make an elegent statement for Your text to link here...
Example : Input : 3 4 5 7 8 9 1 5 4 5 7 9 8 3 9 7 8 Output : YES 5 7 8 Input : 3 4 5 7 8 9 1 5 2 5 7 1 7 Output : NO