Intersection of lists wrong output


#1

7 76 21 20 50 46 91 76
9 43 63 17 84 15 71 60 73 76
5 74 23 18 73 14

How come expected output is 74 -> 23 -> 18 -> 73 -> 14

it should be 76 -> 74 -> 23 -> 18 -> 73 -> 14

C++/Editorial solution given looks wrong.


#2

Anyway got the reason from other threads.