Are you sure that you are treating the graph as undirected? Treating the
edges you get as directed edges will in most cases give you a different
traversal (most of the given graphs are not even connected then).
Obviously, you can use any number of orderings to do either DFS or BFS (or
even none; DFS will work if you visit a random unmarked neighbour). On the
other hand, it would be physically impossible for us to hand check
everybody's output to determine if it matched _some_ valid DFS. So try to
keep the output consistent with the autotest.
Frank