study Fukuoka solution (failed on my own loop-based solution)