Design melodies following the assigned musical pattern while integrating the provided thematic element.
X:1
L:1/8
M:3/4
K:D
['defgab a4 fg a2 f2 d2 A4', 'B2 c2'  
X:1
L:1/8
M:3/4
K:D
 defgab | a4 fg | a2 f2 d2 | A4 A2 | ABcdef | e4 f^g | afecdB | A6 :: A2 B2 c2 | B2 c2 d2 | 
 A2 g2 f2 | e4 f2 | g2 bg e2 | f2 af d2 | egfgac | d6 :|  