more variants of all pairs dist