Design melodies following the assigned musical pattern while integrating the provided thematic element.
X:1
L:1/8
M:4/4
K:D
['D2 FA d2 f2', 'e2 (fa)(fd) B2 (gf) (ed)(cB) (AG)(FE) D2'  
X:1
L:1/8
M:4/4
K:D
 D2 FA d2 f2 | (ed)(cB) (AG)(FE) | D2 FA d2 f2 | (ed)(cd) e2 e2 :: (fa)(fd) B2 (gf) | 
 (ed)(cB) (AG)(FE) | D2 FA d2 f2 | fedc d2 z2 :|  