[2010 Asia Guangzhou Regional Contest Online D Problem][BFS]