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