Finding the last three records containing each value in a set of values