sort list `a` using the first dimension of the element as the key to list `b`,a.sort(key=lambda x: b.index(x[0]))