Abundance analysis of the extremely fast ONeMg novae V838 Herculis and V4160 Sagittarii