uva 11545 - BFS among states