B. Riemann, Theorie der Abel'schen Functionen,  Journal für die reine und angewandte Mathematik **54**, 101–155 (1857).

Here is a description of this contribution, by Jeremy Gray:

In this 1857 paper Riemann established the existence of complex functions on a surface with no boundary. He supposed the surface was *p*-fold connected  which means that it is rendered simply connected by *p* cuts when it forms a *p*-sided p olygon  He showed that there are *p* linearly
independent everywhere holomorphic functions defined inside the polygon by considering what
the Dirichlet
functions are everywhere defined holomorphic integrands  Then he specified *d* points at which the function may have simple poles  again imposing the condition that the functions jump by a constant along the cuts.  Now he argued that to
create functions with only simple poles and constant jumps one took a sum of
 *p* linearly independent functions with no poles plus functions of the form $1/z$ at one of the specified points and added a constant term  The resulting expression depends linearly on $p +  d+1$     constants.  The jumps therefore dep end linearly
 on p   d     constants  and there are  p of them
function is single valued as required   So there will
functions when p   d        p      i e  d   p  This result  today called the Riemann inequality  says there is a linear space of complex functions of dimension h    d       p  and this contains non constant functions as soon as d       p      or d   p