Breath first search(R,A)