Phosphate groups are linked to sugars in DNA and RNA molecules by