Distance models for three-way tables and three-way association