I have a lis: [[1,3],[3,4],[5,6],[8,9],[14,0],[15,8]] I want a code to test when the difference between the first element in the list of list is equal to or larger than 6, then move the previous lists to the end of the list. that is: [[14,0],[15,8],[1,3],[3,4],[5,6],[8,9]]