From a log of which rider visited which city when, count for every ordered triplet of cities how many riders visited them in that order.
From a log of which rider visited which city when, count for every ordered triplet of cities how many riders visited them in that order.
Opens with the full question.