iterate curr and next elements