Compose melodies adhering to the given motif and the outlined musical structure.
X:1
L:1/8
M:4/4
K:G
['g3 a bgag']  
X:1
L:1/8
M:4/4
K:G
 B3 d c2 dc | BGdB cAAc | BGdB G3 d | (3efg eg fdcA | B3 d c2 dc | BGdB cAAg | fdfA gfd=f | 
 eceg fAdf | g3 a bgag | fdd=f ec c2 | g3 a bgag | fAde =f3 d | g3 a bgag | fdd=f ec c2 | 
 d3 =f eceg | fdfa gfdc |]  