hints on distances and matrices