Why did democratic and communist countries emerge as rivals?