check that neighbours are distinct