All grand jurists have said in their edicts that there are three ways of identifying a Mujtahid, and the A'alam:
First: when a person is certain that a particular person is a Mujtahid, or the most learned one. For this, he should be a learned person himself, and should possess the capacity to identify a Mujtahid or an A'alam. Second: when two persons, who are learned and just and possess the capacity to identify a Mujtahid or the A'alam, confirm that a person is a Mujtahid or an A'lam, provided that two other learned and just persons do not contradict them. Third: when a number of learned persons who possess the capacity to identify a Mujtahid or an A'lam, certify that a particular person is a Mujtahid or an A'lam, provided that one is satisfied by their statement. 
Therefore, in such a situation (where the testimony of two just and learned witnesses contradicts the testimony of two other just and learned individuals), one should use the other two ways to identify the most learned Mujtahid.
It is necessary to note that the key point in reaching the truth and finding the most learned of jurists is to make sure that the witnesses are just and that their testimony is based on knowledge and honesty not on egoistic and personal desires or group-based tendencies. Keeping this in view, it will be easier to identify the most learned Mujtahid. If one is unable to identify the most learned Mujtahid through one way, there will be no problem as he can use the other two ways to identify him.
 - Tauzihul Masail (with connotation), Imam Khomeini, vol.1, pg.15, issue No.3