Equivalence of TBA and QTM