I have a nested list with n row and 2 column, its values are numbers, Can I change the order of elements according to the second value?? so every element have in its second value the same value in the first of the next element Example:
y = {{1,4}, {2,3}, {4,2}, {3,1}}
I want to start from the element contains 1, then it contains 4, I want to put the element contains 4 as its first value after it so it would be {4,2}, and the next must be {2,3}, and so on...
output = {{1,4}, {4,2}, {2,3}, {3,1}}
the elements always contains two values only is there any function can do this or I must do this manually???? thank you