Alternating groups and rational functions on surfaces