def relate_files_ts(files1_ts, files2_ts):
    """Relate two sets of timestep-sorted file names with each other."""
    files2_file1 = {}
    for tss1, file1 in files1_ts.items():
        files2_file1[file1] = [
            file2
            for tss2, file2 in files2_ts.items()
            if any(ts1 in tss2 for ts1 in tss1)
        ]
    return files2_file1