Magnetic-sublevel population and alignment for the excitation of H- and He-like uranium in relativistic collisions