finding longest ring doing