Please help me with this:

Write code snippets for the following:
a. create two square of different colours.(Done)
b. add two buttons(labeled forward and backward) to the stage (Done)
c. add a listener to the forward button. The listener function should move whichever of the square to the front.
d. add a listener to the backward button. The listener function should move whichever of the square to the back.

Code:
//1st Square

graphics.lineStyle(2,0x000000);
graphics.beginFill(0x666699)
graphics.moveTo(10,10);
 
graphics.lineTo(10,100);
graphics.lineTo(100,100);
graphics.lineTo(100,10);
 


//2nd Square
graphics.lineStyle(2, 0x000000); 
graphics.beginFill(0xDDDCCC); 
graphics.moveTo(80, 100); 

graphics.lineTo(80, 550);
graphics.lineTo(400, 500);
graphics.lineTo(400, 100);
Help me with C and D Please

Thank You