alpha-gamma Transition in Solid Nitrogen and Carbon Monoxide at High Pressure