Construct a piece of music using the designated motif as the basis, while ensuring the required form is followed.
X:1
L:1/8
Q:1/8=300
M:6/8
K:D
['A2 A AFA d2', 'd2 f g2 g gab f2 f'  
X:1
L:1/8
Q:1/8=300
M:6/8
K:D
 B | A2 A AFA | d2 d def | g2 e f2 d | edB Bcd | A2 A AFA | d2 e f2 g | afd efe | d3 d2 :: f | 
 g2 g gab | f2 f fga | e2 e ede | fdB Bcd | A2 A AFA | d2 e f2 g | afd efe | d3 d2 :|  