  We explore hierarchical black hole (BH) mergers in nuclear star clusters
(NSCs), globular clusters (GCs) and young star clusters (YSCs), accounting for
both original and dynamically assembled binary BHs (BBHs). We find that the
median mass of both first- and nth-generation dynamical mergers is larger in
GCs and YSCs with respect to NSCs, because the lighter BHs are ejected by
supernova kicks from the lower-mass clusters. Also, first- and nth-generation
BH masses are strongly affected by the metallicity of the progenitor stars: the
median mass of the primary BH of a nth-generation merger is $\sim{}24-38$
M$_\odot$ ($\sim{}9-15$ M$_\odot$) in metal-poor (metal-rich) NSCs. The maximum
BH mass mainly depends on the escape velocity: BHs with mass up to several
thousand M$_\odot$ form in NSCs, while YSCs and GCs host BHs with mass up to
several hundred M$_\odot$. Furthermore, we calculate the fraction of mergers
with at least one component in the pair-instability mass gap ($f_{\rm PI}$) and
in the intermediate-mass BH regime ($f_{\rm IMBH}$). In the fiducial model for
dynamical BBHs with metallicity $Z=0.002$, we find $f_{\rm PI}\approx{}0.05$,
$0.02$ and $0.007$ ($f_{\rm IMBH}\approx{}0.012$, $0.002$ and $0.001$) in NSCs,
GCs and YSCs, respectively. Both $f_{\rm PI}$ and $f_{\rm IMBH}$ drop by at
least one order of magnitude at solar metallicity. Finally, we investigate the
formation of GW190521 by assuming that it is either a nearly equal-mass BBH or
an intermediate-mass ratio inspiral.
