Algorithm for card sorting

I need to find an algorithm to sort a deck of cards with THREE rules.

1. We can only look at the top 2 cards on the scrambled deck.

2. We may flip the two cards around if we wish

3. The top card goes to the bottom of the deck

(repeat)

I've tried recreating this situation physically with some cards, and I imagine it looks similar to bubble sort where we try to bubble the smallest number to the bottom of the deck, then the next smallest, and so on and so forth. I just can't seem to get it to work smoothly. So basically I'm looking for other methods of approaching this problem.

Thanks

Re: Algorithm for card sorting

What does "smoothly" mean in programming? I'd be happy if it worked, smoothly or not, so apparently it doesn't work at all.

You can't use other methods. The method is given to you, very specifically. I'm not sure what your question is.