import itertools
def ordered_product(iterables, order):
order = list(reversed(order))
mapping = {x: i for i, x in enumerate(order)}
result = itertools.product(*[iterables[i] for i in order])
result = (tuple(item[mapping[i]] for i in range(len(item))) for item in result)
return result
A = [[1, 3, 5], [0, 2, 4], [5, 7, 9]]
order = [1, 2, 0]
print(list(ordered_product(A, order)))