With the new constraints imposed in the edited question, the answer is "there is no implementation possible."
Please accept this answer so I can claim the meaningless 50 points.