struct MonthDay: CustomStringConvertible {
  static let months = [
    "January", "February", "March", "April", "May", "June",
    "July", "August", "September", "October", "November", "December"
  ]

  var month: Int
  var day: Int

  var description: String { "\(MonthDay.months[month - 1]) \(day)" }

  private func isUniqueIn(months: [MonthDay], by prop: KeyPath<MonthDay, Int>) -> Bool {
    return months.lazy.filter({ $0[keyPath: prop] == self[keyPath: prop] }).count == 1
  }

  func monthIsUniqueIn(months: [MonthDay]) -> Bool {
    return isUniqueIn(months: months, by: \.month)
  }

  func dayIsUniqueIn(months: [MonthDay]) -> Bool {
    return isUniqueIn(months: months, by: \.day)
  }

  func monthWithUniqueDayIn(months: [MonthDay]) -> Bool {
    return months.firstIndex(where: { $0.month == month && $0.dayIsUniqueIn(months: months) })!= nil
  }
}

let choices = [
  MonthDay(month: 5, day: 15),
  MonthDay(month: 5, day: 16),
  MonthDay(month: 5, day: 19),
  MonthDay(month: 6, day: 17),
  MonthDay(month: 6, day: 18),
  MonthDay(month: 7, day: 14),
  MonthDay(month: 7, day: 16),
  MonthDay(month: 8, day: 14),
  MonthDay(month: 8, day: 15),
  MonthDay(month: 8, day: 17)
]