a=b=d=e=f='' x,y='Monoid ',' `mappend` ' n=1 while n<26:n+=1;c=chr(n+96);a+=", "+x+c;b+=","+c;d+=",%c1"%c;e+=",%c2"%c;f+=",%c1"%c+y+c+"2";print"instance ("+x+"a%s) =>"%a,x+"(a%s) where\n mempty = ("%b+(',mempty'*n)[1:]+")\n (a1%s)"%d+y+"(a2%s) = (a1"%e+y+"a2%s)\n"%f