Magic Trick solutions

Magic Trick was solved using PL/SQL by 2 contestants. Solution sizes: average 4358 bytes (shortest: 3270; longest: 5446).