Store unit and last digits of power in res .
res . append ( power [ - 1 ] ) NEW_LINE res . append ( power [ 0 ] ) NEW_LINE for i in range ( 0 , len ( res ) ) : NEW_LINE print ( res [ i ] , end = " " ) NEW_LINE