from re import VERBOSE


def trp(pointer, main_stack, aux_stack):
    """
    Trp
    Take the top element of the main stack to the power of the top element of
    the auxiliary stack.
    If either stack is empty, treat it as zero.
    """
    if VERBOSE:
        print("Trp", main_stack, aux_stack)
    if main_stack:
        a = main_stack.pop()
    else:
        a = 0
    if aux_stack:
        b = aux_stack.pop()
    else:
        b = 0
    # If trying to raise 0 to a negative power, act as a no-op
    if (a != 0 or b >= 0):
        try:
            main_stack.append(a ** b)
        except OverflowError:
            pass
    return(pointer, main_stack, aux_stack)