擇主而事

Etymology

 * c. 1330 - 1400: Luo Guanzhong, Romance of the Three Kingdoms/Chapter 3 and Chapter 14
 * 良禽擇木而棲，賢臣擇主而事.
 * A good bird chooses (for himself) the tree upon which to perch, the talented subject chooses (for himself) the lord that he shall serve.

Idiom

 * 1) to choose a talented and wise lord under which to serve