text: def round_robin(initials):
      """
      Round-robin tournament method.
  
      Pairs each person with every other person eactly once.
      Limitation: Each week one person will not have a coffee date.
      See: https://en.wikipedia.org/wiki/Round-robin_tournament.
  
      Parameters
      ----------
      initials : List[str]
          List of initials to generate dates for.
      """
      n = len(initials)
      pairs = []
      if n % 2 == 0:
          weeks = n - 1
      else:
          weeks = n
          initials = initials + [None]
          n += 1
  
      for i in range(weeks):
          weekpairs = []
          for l in range(n // 2):
              pair = (initials[l], initials[n - (1 + l)])
              if None not in pair:
                  weekpairs.append(pair)
          pairs.append(weekpairs)
          initials.insert(1, initials.pop())
      return pairs
  
  
  def round_robin_compress(initials, pairs):
      """
      Make compressed schedule from pairs generated by round-robin method.
  
      Parameters
      ----------
      initials : List[str]
          List of initials to generate dates for.
      pairs : List[Tuple[str, str]]
          The schedule to compress.
      """
  
      def find_name(pairs, name):
          for i in range(len(pairs)):
              if name in pairs[i]:
                  return i
          return None
  
      for i in range(len(pairs) - 1):
          for name in initials:
              pos_i = find_name(pairs[i], name)
              if pos_i is None:
                  for j in range(i + 1, len(pairs)):
                      pos_j = find_name(pairs[j], name)
                      if pos_j is not None:
                          pair = pairs[j].pop(pos_j)
                          pairs[i].append(pair)
                          break
      pairs = [pair for pair in pairs if len(pair) > 0]
      return pairs
  
  
  def validate(initials, pairs):
      """
      Check how many meetings each person has each week.
      Note: Might be more suited as a unit test.
      """
      per_week = []
      for week in pairs:
          counts = {name: 0 for name in initials}
          for pair in week:
              for name in pair:
                  counts[name] += 1
          per_week.append(counts)
      return per_week
  
  
  if __name__ == "__main__":
      initials = ["CRR", "UCH", "LDB", "MCN", "SLN"]
      pairs = round_robin(initials)
      print(pairs)
      fixed_pairs = round_robin_compress(initials, pairs)
      print(fixed_pairs)
      print(validate(initials, fixed_pairs))
  