How can i swap elements like this?

I am trying to build logic like this in blueprints .
Whenever i call that function it should give me output like this. Can anyone help me to solve it

Or there’s probably a good method with:

344562-screenshot-1.png

But the first thing should work well enough in most scenarios.