Two logicians, Mike and Maureen, have a magic trick. Mike starts with a standard 52card deck of cards. He hands the deck to a random skeptical audience member (let's call him Charles). Mike asks Charles to inspect the deck, shuffle it however he'd like, and then choose any five cards. Mike takes those five cards, then chooses one of them and hands it back to Charles. This is the "mystery card."
Mike then takes the remaining four cards and lays them out on the table in a special order. After looking just at the order of the four cards on the table, Maureen is able to announce the number and suit of Charles's hidden "mystery card". What algorithm are Mike and Maureen using to "encode" the mystery card in the order of the other four cards? Note that the solution uses pure logic, not sleight of hand, and will work no matter how devious Charles is about choosing his five cards.
