Solution to level 19 in Untrusted: http://alex.nisnevich.com/untrusted/