Record most recent data

Hello guys,

I am trying to gather data from these booleans, but I would like to keep only data from the one that has been triggered the latest. So that no matter which one I trigger it only keeps the latest update or puts the latest updated at the end of the list.
When structured following way it prints values from both booleans.

Any ideas?
Thank you very much!

I remember a topic about record the latest value, it need a script

It cannot be 100% correct, as it is possible to change both values and only then run a new solution. For example this happens when States are being restored.