What country was the principal ally of North Korea during the war?