How to make Anydice see if two values are the same among 3 dice and keep them?


Is there a way to calculate/simulate rolling 3d20 and spit the middle one (that is easily done with middle function), or if its value is the same as the high or the low one, spit that one too?