title: Sort a list of tuples in consecutive order
body: <p>I want to sort a list of tuples in a <strong>consecutive order</strong>, so the first element of each tuple is equal to the last element of the previous one. </p>
  
  <p>For example:</p>
  
  <pre><code>input = [(10, 7), (4, 9), (13, 4), (7, 13), (9, 10)]
  output = [(10, 7), (7, 13), (13, 4), (4, 9), (9, 10)]
  </code></pre>
  
  <p>I have developed a search like this:</p>
  
  <pre><code>output=[]
  given = [(10, 7), (4, 9), (13, 4), (7, 13), (9, 10)]
  t = given[0][0]
  for i in range(len(given)):
        # search tuples starting with element t
        output += [e for e in given if e[0] == t]
        t = output[-1][-1] # Get the next element to search
  
  print(output)    
  </code></pre>
  
  <p>Is there a pythonic way to achieve such order?
  And a way to do it "in-place" (with only a list)?</p>
  
  <p>In my problem, the input can be reordered in a circular way using all the tuples, so it is not important the first element chosen.</p>