The old cold war between the US and the Soviet Union, or the NATO and the Warsaw Pact countries, had some clear lines of division. China gradually moved from the anti-US camp to the anti-Soviet comp and in the course maximised its benefits, proving self-interest and not ideology was the essence.
