write the logic for displaying this:

A B C B A
A B B A
A A
please explain the total logic for tc compiler!