Competition between modes with different axial structures in gyrotrons