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