here is how i get the longest distance from three sequences but for 360 sequences it would be really large graph: