who did not follow legalism and believed in the teachings of Confucius?