Laser-induced compound formation and transfer of stacked elemental layers