Solution for Upsilon 2012 task