Solution for some puzzle