Passes sample input, full Schams on.
Passes both small and large output, pretty quickly.