I want to sort the list of users in order of many-to-many relationship

I have a property Z that allows users to have a many-to-many relationship with each other.
When user A likes user B, user A is added to user B’s property Z.
Next, when user C likes user B, user C is added to the property Z of user B.
Finally, when user D likes user B, user D is added to the property Z of user B.
In this case, I want user B to be able to browse users in the order in which they entered into a many-to-many relationship.
(User A → User C → User D)
I would like to be able to set the sort function in the sort list so that the list can be sorted in the order of the many-to-many relationships.
※I do not want to take the approach of creating a new collection with date properties attached to it in order to do this. (as it would be heavy and would add one more action)