The solution of Subtask 1 is straightforward – since there is no person between friends forming a couple, we can send all n couples to a date without having to do any swaps. This requires n actions.
Similarly, in Subtask 2, we process friends from