Replace an element that is inside a repeater by clicking an element inside a different repeater

I have a repeater with 3 images in a row, same ids, same container ids. I would like the user to click any image inside the repeater to replace the image inside a different repeater with that clicked image. Both repeaters and elements are connected to datasets.