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