def unique(input):
    """
    If the same N_S_L_C occurs twice, merge the dates into a single entry.
    Needed for the fast comparison (of sorted files) to work correctly.
    """
    output = []
    for sncl, dates in sorted(input):
        if output and sncl == output[-1][0]:
            output[-1][1].append(dates[0])
        else:
            output.append((sncl, dates))
    return output
