The nature of deuterium arrangements in YD3 and other rare-earth trideuterides