# La función de Takeuchi en Python

def tak(x,y,z):
    if x <= y:
        return y
    else:
        return tak(tak(x - 1, y, z),
                   tak(y - 1, z, x),
                   tak(z - 1, x, y))

# Eficiencia
# ==========

import time

tiempo_inicial = time.time()
tak(12,6,1)
print("Tiempo = %s segundos " % (time.time() - tiempo_inicial))    
# Tiempo = 0.6820645332336426 segundos 

# tiempo_inicial = time.time()
# tak(16,6,1)
# print("Tiempo = %s segundos " % (time.time() - tiempo_inicial))    
# # Tiempo = 138.33993339538574 segundos 
