Hello, I am trying to solve this problem

http://www.usaco.org/index.php?page=viewproblem2&cpid=1181

My approach is :

If we have three number a, b, c and we want to make them equal there is only on number x such that we can make a, b, c equal to x or there is no number.

I want all elements values to be y

If i know the value of y I can check if I can make the numbers equal, the value of y can be either the first element or the value x to make the first three element equal to each other.

Is this true ? if its not ture where is the wrong ?