which belief system was the basis for the civil service exam given during the han, tang & song dynasties