How did all the water on planet Earth form see the details?

Water is formed by putting hydrogen and oxygen together usually through the combustion of hydrogen with oxygen so where did all this free hydrogen and free oxygen come from? or where did all this water come from if it didn't come about by the combining of hydrogen and free oxygen
10 answers 10