问题 检查元素是否在所有列表中一起出现?


假设我有一个列表,如下所示:

l = [[1,2,3],[6,5,4,3,7,2],[4,3,2,9],[6,7],[5,1,0],[6,3,2,7]]

我如何编写python代码来检查是否有总是一起出现的元素?例如,在上面的例子中,2,3和6,7总是出现在相同的列表中。 (可能还有其他人,不确定)。

实现这一目标的最简单方法是什么?

我唯一的想法是转换 inner-list1 设置和检查交集 inner-list2 但是当我检查交叉路口时 inner-list3,这些元素可能根本不会发生 inner-list3

我可以这样做:

for i in range(0,len(lists)):    
    a=set(lists[i]).intersection(lists[i+1])
    if (len(a))==0:
        continue
    else:
        a.intersection(lists[i+1])

这当然不起作用,但我怎么能正式编码这个或者有更好的方法吗?


12416
2017-11-11 17:05


起源

对于2组合,这很容易,但是如果你看看是否有问题就更难了 3 总是与...一起出现 1 和 2。 - Willem Van Onsem
是的 elements 的 lists 总是 integers 从 1-9? - Joe Iddon
是的,总是从1到9和2或更多的整数可能会像@WillemVanOnsem一样出现。虽然理想情况下我想要一个适用于任何整数的解决方案,而不仅仅是1到9。 - doddy


答案:


运用 itertools.combinations

我最初想过用的东西 itertools.combination但正如这允许的那样 elements 从一个 list 它们不是彼此相邻的,它不适用于我想到的解决方案。

事实证明,当看非数字输入时 listsitertools.combinations   两种情况都是必要的。我很困惑,因为我认为了 groups 必须是 adjacent

我认为最适合这种方式的方法是产生可能的方法 elements 那 可以 工作,然后检查每一个 function 反对这 list 的 sub-lists  - 而不是做某种组合工作 list 沿着那条路走下去。

所以要检查一下 list 可能的 elements 是'有效',即如果全部 elements 只发生在一起,我用的很简单 if 用发电机 all() 和 any() 内建的 functions 做这部分工作。

现在这是有效的,需要有一种产生潜力的方法 elements 可能会发生。我刚刚用两个嵌套做了这个 for-loops  - 一个 iterating 过了 width 的 window和一个 iterating 在哪里 start 的 window 是。

然后从这里,我们只检查那组 elements 是 valid 并将其添加到另一个 list 如果是!


import itertools

def valid(p):
    for s in l:
        if any(e in s for e in p) and not all(e in s for e in p):
            return False
    return True

l = [[1,2,3],[6,5,4,3,7,2],[4,3,2,9],[6,7],[5,1,0],[6,3,2,7]]
els = list(set(b for a in l for b in a))
sol = []
for w in range(2,len(els)+1):
    for c in itertools.combinations(els, w):
        if valid(c):
            sol.append(c)

这使 sol 如:

[(2, 3), (6, 7)]]

这些 2  nested for-loops 实际上可以被扔到一起很好 one-liner (不确定其他人是否认为它是Pythonic):

sol = [c for w in range(2, len(els)+1) for c in itertools.combinations(els, w) if valid(c)]

它的工作原理相同但只是更短。


由于受欢迎的需求(@Arman),我已经更新了答案,现在它应该适用于其他人 elements 除了 0-9。这是通过引入一个独特的 elements  list (els)。


还有一些测试来自 @thanasisp 使用上面相同的代码:

l = [[1, 3, 5, 7],[1, 3, 5, 7]]

sol 如:

[(1, 3), (1, 5), (1, 7), (3, 5), (3, 7), (5, 7), (1, 3, 5), (1, 3, 7), (1, 5, 7), (3, 5, 7), (1, 3, 5, 7)]

并再次:

 l = [[1, 2, 3, 5, 7], [1, 3, 5, 7]]

得到:

 [(1, 3), (1, 5), (1, 7), (3, 5), (3, 7), (5, 7), (1, 3, 5), (1, 3, 7), (1, 5, 7), (3, 5, 7), (1, 3, 5, 7)]

我相信这是正确的 2  不能 像其他所有人一样在任何群体中 elements 是一个不同的 sub-list,所以它永远不能与另一个组成一个团体 element


5
2017-11-11 17:34



如果整数大于9,这怎么会不起作用。 - ᴀʀᴍᴀɴ
@Arman是的,但是我确定在写完答案之前先询问OP,如果那样的话很好...... - Joe Iddon
虽然理想情况下我想要一个适用于任何整数的解决方案,而不仅仅是1到9 OP说。 - ᴀʀᴍᴀɴ
@Arman True但是,它仍然回答了这个问题 - Joe Iddon
@Arman我会看看我是否可以改进我的解决方案,因此逻辑保持不变,但不限于此 1-9... - Joe Iddon


另一个具有默认dicts的线性解决方案(元组可用于制作可用密钥):

from collections import defaultdict
isin,contains = defaultdict(list),defaultdict(list)

for i,s in enumerate(l):
    for k in s : 
        isin[k].append(i)

# isin is  {1: [0, 4], 2: [0, 1, 2, 5], 3: [0, 1, 2, 5], 6: [1, 3, 5],
# 5: [1, 4], 4: [1, 2], 7: [1, 3, 5], 9: [2], 0: [4]}
# element 1 is in sets numbered 0 and 4, and so on.

for k,ss in isin.items(): 
    contains[tuple(ss)].append(k)

# contains is  {(0, 4): [1], (0, 1, 2, 5): [2, 3], (1, 3, 5): [6, 7],
# (1, 4): [5], (1, 2): [4], (2,): [9], (4,): [0]})
# sets 0 and 4  contains 1, and no other contain 1. 

现在,如果您查找按组显示的元素 n  (n=2 在这里),键入:

print ([p for p in contains.values() if len(p)==n])    
# [[2, 3], [6, 7]]

3
2017-11-11 18:26



尼斯。您可以将条件更改为 len(p) >= 2 虽然让它更通用。 - tobias_k
它可以用于2个以上的元素吗? - Shihab Shahriar
是的,只需为x元素更改len(p)== x即可。 - B. M.
我不这么认为。第一个循环做N完全追加。 - B. M.


这是我现在想到的强力选择, dct是每个数字的计数字典,然后我们检查相同的列表 dct 这意味着两个数字出现在相同的列表索引中:

l = [[1,2,3],[6,5,4,3,7,2,1],[4,3,2,9,1],[6,7],[5,1,2,3,0],[6,3,2,7,1]]
dct = defaultdict(list)
for i, v in enumerate(l):
    for x in v:
        dct[x].append(i)

dct # defaultdict(<class 'list'>, {0: [4], 1: [0, 1, 2, 4, 5], 2: [0, 1, 2, 4, 5], 3: [0, 1, 2, 4, 5], 4: [1, 2], 5: [1, 4], 6: [1, 3, 5], 7: [1, 3, 5], 9: [2]})
new_d = defaultdict(list)
for k, v in dct.items():
    for k2, v2 in dct.items():
        if(v == v2) and k != k2):
            new_d[k].append(k2)
new_d # defaultdict(<class 'list'>, {1: [2, 3], 2: [1, 3], 3: [1, 2], 6: [7], 7: [6]})

它也是一个非常昂贵的操作 O(N*N*M) : N = list elements 和 M = longest sublist


2
2017-11-11 17:26



你不能实例化 dct 套装(即 dct = defaultdict(set))这意味着您以后不需要进行设置转换。 - Ben
@Ben,你是对的,如果有一个例子,一个数字出现在一个列表中两次,因为列表按排序顺序甚至不必转换为 set,我没有注意到列表已被排序 dct,我编辑了我的答案。 - ᴀʀᴍᴀɴ


你可以使用set intersection进行此操作,并且它也适用于每组3个或更多元素:注意我添加了一个 8 到了 6,7 组。

lists = [[1,2,3], [6,5,4,3,7,2,8], [4,3,2,9], [8,6,7], [5,1,0], [6,3,8,2,7]]

首先,我们将每个元素映射到它与之一起出现的所有其他元素的集合:

groups = {}
for lst in lists:
    for x in lst:
        if x not in groups:
            groups[x] = set(lst)
        else:
            groups[x].intersection_update(lst)
# {0: {0, 1, 5}, 1: {1}, 2: {2, 3}, 3: {2, 3}, 4: {2, 3, 4}, 5: {5}, 
#  6: {8, 6, 7}, 7: {8, 6, 7}, 8: {8, 6, 7}, 9: {9, 2, 3, 4}}

接下来,我们只保留关系是双向的元素:

groups2 = {k: {v for v in groups[k] if k in groups[v]} for k in groups}
# {0: {0}, 1: {1}, 2: {2, 3}, 3: {2, 3}, 4: {4}, 5: {5}, 
#  6: {8, 6, 7}, 7: {8, 6, 7}, 8: {8, 6, 7}, 9: {9}}

最后,我们获得具有多个元素的唯一组:

groups3 = {frozenset(v) for v in groups2.values() if len(v) > 1}
# {frozenset({8, 6, 7}), frozenset({2, 3})}

2
2017-11-11 23:12



我能说对不起吗? - Shihab Shahriar


以下解决方案有一个 线性  O(n) 复杂性,其中n是所有列表中的数字总数(展平后)。代码是 Python2.x

我正在使用所有可能模式的位图表示(使用python的无限数字)。例如,如果有一个数字 list0 和 list2 但不是 list1,各自的模式将是 ...000101。例如,在给定输入中,值2将具有以下位图模式: 100111 价值3也是如此

l = [[1,2,3],[6,5,4,3,7,2],[4,3,2,9],[6,7],[5,1,0],[6,3,2,7]]

num_to_pattern = {}
for i, sublist in enumerate(l):
    for num in sublist:
        # turning ON the respective bit for each value
        if not num in num_to_pattern:
            num_to_pattern[num] = 1 << i
        else:
            num_to_pattern[num] |= (1 << i)

pattern_to_num_list = {}
# mapping patterns to all their respective numbers
for num, pattern in num_to_pattern.iteritems():
    if not pattern in pattern_to_num_list:
        pattern_to_num_list[pattern] = [num]
    else:
        pattern_to_num_list[pattern].append(num)

print pattern_to_num_list

此代码将打印:

{4: [9], 6: [4], 39: [2, 3], 42: [6, 7], 16: [0], 17: [1], 18: [5]}

并且您可以映射和过滤您想要的任何子列表(在您的情况下 - 列表等于或大于2):

print filter(lambda x: len(x) >= 2, pattern_to_num_list.values())

1
2017-11-11 17:42



这很酷,但恕我直言,代码可以缩短,更容易理解使用 collections.defaultdict, |= 运营商。列表理解。 - tobias_k
不是线性的。你正在进行的k位操作每次需要O(k)次。核心问题是位掩码表示必须在所有零上花费位,因此其大小与最高设置位而不是设置位数成比例。 - user2357112


实现这一目标的最简单方法是什么?

我试图让我的解决方案尽可能短。我也尽可能地优化它。它适用于 任何整数 根据你喜欢的。

这是带有很多注释的代码 说明 它,接着是 更多 基本解释:

注意:在下面的代码中,我使用了 [[1, 2, 3], [2, 1, 4]] 作为原始列表的示例而不是您问题中的列表,使解释更容易。

import itertools

# The original list of lists
org_list = [[1, 2, 3], [2, 1, 4]]

# Sort the lists of org_list to ensure that the resulting tuples of
# itertools.combinations below are sorted also, because later, we 
# don't want (1, 2) to be not equal to (2, 1)
org_list = [sorted(l) for l in org_list]

# This list will contain the combinations of the original list
list_of_combinations = []

# --Building list_of_combinations--
# Looping through every list in the original list of lists (org_list)
for i, l in enumerate(org_list):
    # Create a new set to hold the combinations for the i-th list of org_list
    list_of_combinations.append(set())
    # Starting with 2 because we want the combination to contain two
    # items at least, and ending at len(org_list[i])+1 because we want
    # the maximum length of the combination to be equal to the length
    # of its original list
    for comb_length in range(2, len(l) + 1):
        # Update the set with its combinations of length comb_length
        list_of_combinations[i].update(
            tuple(itertools.combinations(org_list[i], comb_length))
        )

# Now list_of_combinations = [
#                               {(1, 2), (1, 3), (2, 3), (1, 2, 3)},
#                               {(1, 2), (1, 2, 4), (2, 4), (1, 4)}
#                           ]

# This will hold the result. In our case: [2, 3], and [6, 7]
# It is a set because we don't want the result to contain duplicate items
combs = set()

# Looping through the sets in list_of_combinations
for s in list_of_combinations:
    # s = {(1, 2), (1, 3), (2, 3), (1, 2, 3)} for example
    # Looping through the combinations in the set s
    for comb in s:
        # comb = (1, 2) for example
        # Set a flag (f) initially to 1
        f = 1
        # Loop through the sets in list_of_combinations
        for ind, se in enumerate(list_of_combinations):
            # See if comb exists in the set se
            if comb not in se:
                # If not, see if any number in comb exists in the ind-th list of
                # the original list
                for n in comb:
                    if n in org_list[ind]:
                        # If so, set f to 0
                        f = 0
                        break
        # if f is still 1, then the current comb satisfy our conditions
        # so we add it to the result
        if f == 1:
            combs.add(comb)

print(combs)

输出:

{(1, 2)}

正如所料。

对于您问题中的列表,此代码的输出是 {(2, 3), (6, 7)} 这也是预期的。


itertools.combinations

itertools.combinations(iterable, r):退货 r 来自输入的元素的长度元组 iterable。例如:

list(itertools.combinations([1, 2, 3], 2))

[(1, 2), (1, 3), (2, 3)]


为什么使用套装?

在上面的代码中,您可以注意到集合用于保存原始列表中每个列表的组合。这是因为检查集合中的值的成员资格是 非常 快,我们在代码中做了很多这样的检查。


解释主要想法

假设我们的原始列表是 [[1, 2, 3], [2, 1, 4]]

  1. 获取原始列表中所需的一组组合:

    对于 [1, 2, 3]:组合的集合是 (1, 2), (1, 3), (2, 3), (1, 2, 3)

    对于 [2, 1, 4]:组合的集合是 (1, 2), (1, 2, 4), (2, 4), (1, 4)

  2. 对于  的组合,以及为了在我们的代码的输出(意味着它满足我们的条件),我们要确保为  一组组合,

    • 存在 在这个集合中(即这个组合的项目在这个集合中一起出现)
    • 或者确实如此  存在于这个集合中 - > 没有 其项目应出现在相应的列表中


    例如

    让我们来 (1, 3) 来自 第一 一组组合。我们遍历组合集:

    为了 第一 设置,我们可以看到 (1, 3) 存在于其中,所以我们向前迈进。

    为了 第二 设置,我们可以看到它不存在,所以我们想看看是否存在 任何 其项目存在于相应的清单中(即 第二 原始清单清单: [2, 1, 4]):

    从...开始 1,我们可以看到它存在于相应的列表中 - > (1, 3) 不能在输出中,因为它不满足所需的条件。


1
2017-11-12 07:11



@ammarx ...如果我的语气看起来很粗鲁,我很抱歉。在给出的例子中,尝试将[6,7]转换为[6,7,3] ......我可能错了.. - Shihab Shahriar
@ShihabShahriar不用担心。但是,如果您遇到问题,请说清楚,并说明您的期望和原因,以便我们努力解决问题;我不明白你的意思是“试着转过身来 [6,7] 至 [6,7,3]”。 - ammarx
@ShihabShahriar如果你添加 3 至 [6,7],3仍然不总是与6和7一起出现(它也出现在没有6或7的列表中),并且它也不再总是与2一起出现(没有2 in [3,6,7])。 - tobias_k


首先是数据

data = [[1,2,3],[6,5,4,3,7,2],[4,3,2,9],[6,7],[5,1,0],[6,3,2,7]]

生成组合很昂贵,所以我想尽可能地避免这种情况。

我的“尤里卡!”当我意识到我不需要生成所有对时,我就来了。相反,我可以将每个数字映射到包含它的所有列表。

appears_in = defaultdict(set)
for g in groups:
    for number in g:
        appears_in[number].add(tuple(g))

结果字典是

{0: {(5, 1, 0)},
 1: {(5, 1, 0), (1, 2, 3)},
 2: {(4, 3, 2, 9), (6, 3, 2, 7), (6, 5, 4, 3, 7, 2), (1, 2, 3)},
 3: {(4, 3, 2, 9), (6, 3, 2, 7), (6, 5, 4, 3, 7, 2), (1, 2, 3)},
 4: {(4, 3, 2, 9), (6, 5, 4, 3, 7, 2)},
 5: {(5, 1, 0), (6, 5, 4, 3, 7, 2)},
 6: {(6, 3, 2, 7), (6, 7), (6, 5, 4, 3, 7, 2)},
 7: {(6, 3, 2, 7), (6, 7), (6, 5, 4, 3, 7, 2)},
 9: {(4, 3, 2, 9)}}

查看2和3的条目

2: {(4, 3, 2, 9), (6, 3, 2, 7), (6, 5, 4, 3, 7, 2), (1, 2, 3)},
3: {(4, 3, 2, 9), (6, 3, 2, 7), (6, 5, 4, 3, 7, 2), (1, 2, 3)},

包含2的列表集与包含3的列表集相同。因此,我得出结论,2和3总是一起出现。

将其与3和4进行对比

 3: {(4, 3, 2, 9), (6, 3, 2, 7), (6, 5, 4, 3, 7, 2), (1, 2, 3)},
 4: {(4, 3, 2, 9),               (6, 5, 4, 3, 7, 2)},

注意差距在哪里 (6, 3, 2, 7) 和 (1, 2, 3) 应该。我得出结论,3和4并不总是一起出现。

这是完整的代码

from collections import defaultdict
from itertools import combinations
from pprint import pprint

def always_appear_together(groups):
    appears_in = defaultdict(set)
    for g in groups:
        for number in g:
            appears_in[number].add(tuple(g))
    #pprint(appears_in)    # for debugging                                                                                                                        
    return [
        (i,j) 
        for (i,val_i),(j,val_j) in combinations(appears_in.items(),2) 
        if val_i == val_j
    ]

运行这个给出

print(always_appear_together(data))
[(2, 3), (6, 7)]

1
2017-11-20 15:37





这更像是一个强力解决方案,但是,它将通过生成每个子列表的排列,生成一个大的所有元素列表。 l 并过滤以查找其元素全部出现在子列表中的任何排列 l。如果任何排列通过该条件,则将添加排列 final_pairs

l = [[1,2,3],[6,5,4,3,7,2],[4,3,2,9],[6,7],[5,1,0],[6,3,2,7]]
import itertools
final_pairs = []
for i in l:
    combos = [list(itertools.permutations(i, b)) for b in range(2, len(i))]
    for combo in combos:
         for b in combo:
            if any(all(c in a for c in b) for a in l):
                final_pairs.append(combo)

final_data = list(set(itertools.chain.from_iterable(final_pairs)))

输出:

[(2, 5, 6, 7, 3), (7, 3), (2, 6, 3, 7), (5, 3, 2, 6, 7), (5, 6, 4, 7), (7, 2, 5, 4, 6), (6, 7, 3, 4), (5, 2, 3, 7, 6), (7, 4, 3, 2), (6, 4, 7, 2), (4, 7, 6), (7, 3, 4, 6, 2), (5, 3, 7, 2, 6), (5, 7, 6, 4), (7, 4, 6, 2, 5), (7, 5, 4, 6, 3), (4, 2, 7, 3, 5), (4, 7, 3, 2), (2, 5, 4, 7, 3), (6, 5, 7, 2, 4), (4, 6, 7, 2), (2, 7, 5, 6, 3), (2, 6, 7), (5, 4, 2, 3, 7), (2, 3, 4, 6, 5), (5, 7, 2, 3), (3, 2, 4, 7, 6), (2, 6, 3, 5, 7), (3, 6, 5, 4, 7), (6, 5, 7), (2, 4, 6, 7, 5), (4, 3, 5, 2), (2, 3, 5, 7), (4, 5, 7, 3), (4, 6, 7, 2, 5), (3, 4, 5, 7, 2), (2, 4, 5, 6, 3), (3, 5, 2, 7, 6), (6, 3, 5, 7, 2), (5, 2, 7, 3, 6), (6, 3, 5, 4, 2), (2, 7, 4, 5), (2, 5, 3), (3, 2), (3, 2, 6, 7), (5, 3, 7, 6, 4), (4, 5), (2, 7, 3, 6, 4), (6, 4, 2, 5), (7, 5, 4, 2, 6), (2, 4, 3, 7, 6), (3, 2, 6), (4, 5, 3, 6), (7, 4, 3, 6, 5), (7, 3, 4), (5, 3, 4, 6, 7), (6, 5, 3, 2, 4), (6, 4, 2, 3), (5, 2, 7, 6, 3), (5, 4, 6, 3, 7), (3, 2, 6, 5, 7), (6, 5, 4, 3, 7), (3, 5, 2, 6, 4), (7, 3, 6, 2, 5), (2, 3, 7, 6, 4), (3, 4, 5, 2, 7), (7, 3, 5, 2), (2, 4, 5, 7), (2, 3, 6, 4), (7, 5, 6, 4), (7, 6, 2), (3, 9, 4), (4, 6, 5), (6, 4, 5, 3, 2), (6, 7, 3, 2, 5), (3, 5, 7, 6), (2, 5, 3, 4, 6), (5, 3, 6), (2, 3, 4, 6, 7), (6, 5, 2, 3, 7), (6, 3, 5, 2, 4), (5, 4, 2, 3), (5, 7, 6, 3, 2), (4, 6, 5, 2, 7), (7, 5, 2, 3), (4, 5, 2, 6, 3), (5, 7, 6, 3), (2, 7, 3, 4, 6), (2, 3, 6), (7, 4, 3, 5), (4, 3, 5, 6, 7), (7, 3, 6, 5, 2), (6, 2, 5, 3, 7), (5, 6, 4), (5, 2, 7, 6), (4, 6, 2, 3), (4, 3, 2, 6, 7), (3, 2, 7, 5), (6, 7, 2, 4, 5), (4, 3, 6, 2), (4, 3, 6, 7, 2), (6, 7, 4, 3, 2), (5, 1), (5, 7, 4, 3, 2), (6, 3, 7), (6, 7, 3, 4, 2), (7, 6, 3, 5, 2), (4, 9, 3), (4, 7, 5, 2), (5, 4, 2, 7, 6), (5, 3, 7, 2, 4), (3, 2, 5, 4, 7), (4, 2, 5, 7, 6), (3, 7, 6, 4), (7, 3, 2, 6, 4), (7, 2, 5, 3, 6), (2, 3, 5, 6, 4), (4, 5, 2, 3, 6), (5, 6, 7, 4, 3), (4, 2, 6, 5, 7), (6, 2, 3, 7), (7, 4, 5, 3), (5, 3, 4, 2, 7), (5, 7, 3), (5, 7, 3, 2, 6), (3, 5, 2, 7), (2, 7, 6, 5, 4), (4, 6, 5, 7), (3, 4, 7, 6, 5), (6, 2, 3, 5, 7), (6, 5, 3, 4, 2), (5, 4, 7, 2), (5, 7, 4, 6), (7, 6, 2, 5), (3, 4, 9), (6, 4, 5, 7, 2), (4, 7, 5, 3, 2), (3, 5, 6, 2), (4, 7, 2, 6, 3), (5, 4, 7), (5, 3, 7, 6, 2), (2, 4, 3, 5, 7), (1, 0), (3, 2, 6, 7, 5), (2, 3, 4, 7, 6), (6, 5, 2, 7), (7, 5, 2, 4, 3), (5, 3, 6, 2, 4), (2, 7), (2, 3, 6, 5, 7), (5, 3, 2, 6), (2, 6, 3, 4, 5), (6, 3, 7, 4, 5), (5, 6, 4, 2, 3), (2, 6, 5, 3, 4), (3, 4, 2, 7, 5), (5, 7, 3, 6, 4), (6, 3, 4, 5), (7, 4), (6, 7, 5), (7, 4, 6, 2), (6, 4, 3, 2, 7), (3, 5, 6), (3, 5, 6, 4, 2), (7, 2, 4), (2, 3, 6, 4, 5), (4, 2, 3), (2, 5, 3, 4, 7), (5, 2, 3, 6, 7), (4, 7, 6, 2), (3, 4, 6), (4, 3, 7, 6, 5), (7, 2, 4, 6, 5), (5, 3, 6, 7), (4, 6, 2, 5, 7), (6, 4, 3, 7, 2), (7, 4, 5, 2, 6), (3, 6, 7, 4, 5), (3, 6, 2, 5, 7), (3, 6, 2, 5), (5, 3, 4, 2, 6), (6, 5, 4, 3), (7, 4, 2, 3, 5), (2, 4, 5, 6, 7), (3, 7, 4, 5, 2), (2, 4, 7, 5), (5, 7, 3, 4), (7, 5, 4, 6), (4, 7, 6, 5, 3), (4, 3, 2, 6, 5), (7, 6, 2, 4, 5), (6, 3, 4), (3, 4, 6, 2, 5), (2, 5, 4, 6, 3), (2, 6, 3, 7, 5), (6, 7, 2, 5, 4), (6, 5, 7, 3, 2), (4, 7, 3, 2, 6), (2, 6, 7, 4, 5), (2, 3, 5, 6), (3, 2, 5, 4), (5, 7, 6, 4, 2), (2, 4, 5, 7, 3), (7, 5, 4, 2, 3), (7, 6, 3, 5), (6, 5, 4), (3, 6, 5, 7, 4), (2, 7, 3, 6, 5), (4, 5, 2, 7), (7, 3, 5, 6, 4), (5, 7, 4, 2, 6), (7, 4, 3, 5, 6), (3, 4, 6, 2, 7), (2, 5, 4, 7), (2, 7, 6, 3, 4), (5, 7, 3, 2, 4), (2, 6, 7, 3), (3, 4, 2, 5), (3, 7, 2, 4, 6), (7, 6, 4, 2, 3), (3, 2, 7), (7, 6, 5, 2, 3), (7, 6, 4, 3), (5, 6, 3, 2, 4), (6, 5, 3, 4, 7), (9, 2, 4), (6, 7, 3, 5), (2, 3, 4, 7, 5), (7, 6, 4, 5), (6, 2, 5, 4), (5, 6, 7, 2, 4), (4, 6, 5, 7, 3), (4, 2, 3, 5, 6), (4, 5, 7, 3, 2), (4, 2, 6, 7), (6, 3, 4, 5, 7), (4, 7, 6, 2, 5), (7, 6, 3), (2, 6, 7, 3, 4), (6, 7, 3, 4, 5), (4, 6, 7, 5), (7, 5, 3, 4), (5, 6, 7, 3, 2), (5, 2, 6, 7), (3, 4), (7, 5, 3, 4, 6), (5, 7, 3, 6, 2), (7, 3, 6, 2, 4), (4, 7), (4, 5, 7, 6), (5, 6, 4, 2, 7), (3, 6, 7, 4), (5, 6), (7, 2, 5, 6, 4), (4, 5, 6, 7, 3), (2, 4, 3, 6, 5), (2, 3, 7), (7, 6, 3, 2, 4), (6, 4, 3, 5, 7), (6, 2, 7), (6, 3, 2, 7), (3, 5, 4, 6), (7, 6, 5, 4, 2), (6, 4, 7), (3, 7, 4, 2, 6), (3, 4, 2), (6, 2, 7, 5, 4), (2, 6, 5, 7, 3), (6, 2, 4, 5, 3), (4, 5, 3, 7), (4, 2, 6, 7, 3), (2, 4, 3), (4, 7, 3, 6, 5), (2, 4, 6, 3, 5), (6, 5, 7, 4, 3), (3, 7, 4, 6, 5), (7, 2, 4, 3, 6), (6, 7, 3, 2, 4), (6, 2, 7, 5, 3), (3, 4, 7, 2), (7, 4, 5, 6, 3), (2, 6, 5, 4, 7), (3, 6, 4, 7), (5, 7, 2), (2, 4, 5, 6), (2, 7, 4, 3, 6), (4, 5, 6, 2, 7), (5, 2, 3, 6), (4, 9, 2), (5, 4, 6, 7), (7, 3, 4, 6), (3, 2, 5, 7, 6), (7, 5, 4, 6, 2), (3, 7, 2, 5, 6), (3, 6, 5, 2, 4), (6, 4, 2, 3, 5), (6, 3, 2, 4, 7), (5, 4, 3, 7, 2), (5, 4, 3, 7, 6), (5, 7, 2, 4, 3), (3, 7, 2, 4), (4, 3, 2, 6), (4, 2, 6, 3, 5), (7, 4, 2, 6, 3), (4, 3, 6, 7), (2, 7, 5, 4), (5, 2, 4, 3, 7), (7, 3, 5, 4, 2), (3, 5, 2, 4, 6), (3, 2, 7, 6), (5, 7, 4, 6, 3), (9, 2, 3), (3, 2, 4, 5, 6), (2, 7, 5, 6, 4), (5, 3, 7, 6), (4, 7, 5, 3), (7, 3, 5, 2, 6), (6, 2, 7, 3), (7, 3, 4, 2, 5), (3, 7, 6, 5), (7, 2, 5), (5, 6, 2, 4), (7, 4, 5, 6), (2, 7, 6, 4, 3), (6, 2, 7, 5), (3, 6, 4, 7, 2), (2, 4, 3, 7, 5), (2, 6, 5, 7), (2, 5, 3, 6, 7), (3, 5, 2, 4), (1, 3), (4, 7, 3, 5, 6), (4, 5, 7, 3, 6), (2, 5), (2, 4, 7, 3, 5), (5, 4, 7, 3), (6, 5, 4, 2, 7), (5, 3, 2, 4, 7), (7, 3, 2, 6, 5), (7, 6, 2, 4), (5, 2, 3), (6, 7), (3, 6, 5, 7), (7, 6), (2, 7, 6, 3), (7, 5, 6, 2, 4), (4, 6, 2, 5, 3), (2, 6, 5), (6, 7, 5, 2), (3, 7, 5, 6), (6, 5, 2, 4, 7), (5, 4, 7, 2, 3), (5, 4, 3, 6), (4, 6, 2, 7, 5), (4, 2, 6, 7, 5), (5, 3, 2, 7), (5, 2, 4, 3), (7, 4, 6, 3, 2), (6, 4, 3, 2, 5), (3, 7, 4, 5, 6), (3, 7, 2), (7, 6, 3, 4, 2), (6, 2, 5, 7, 4), (2, 5, 4, 6, 7), (6, 3, 4, 2, 7), (7, 5, 2, 3, 6), (7, 6, 4, 5, 3), (5, 3, 6, 4, 7), (5, 3, 6, 2), (4, 7, 2, 5, 3), (4, 7, 6, 5), (4, 2, 7, 6), (7, 5, 6), (2, 6, 4, 5), (2, 4, 7, 6, 3), (3, 2, 4), (5, 3, 6, 4), (3, 7, 2, 5, 4), (7, 3, 6), (5, 3, 2, 7, 6), (2, 3, 7, 4, 5), (6, 3, 2, 5, 4), (2, 6, 4, 3), (3, 7, 6, 5, 2), (9, 4, 3), (6, 7, 2, 3, 5), (7, 4, 5, 3, 6), (3, 1), (2, 4, 5, 3, 6), (3, 6, 2, 4), (2, 5, 3, 4), (5, 2, 7, 3, 4), (4, 3, 6), (3, 2, 4, 6, 7), (3, 4, 5, 6), (5, 7, 3, 4, 6), (3, 6, 4, 5), (3, 4, 7, 5), (2, 4, 3, 5), (4, 6, 7), (5, 4, 3, 6, 2), (7, 3, 6, 4), (3, 2, 4, 6, 5), (4, 5, 6, 3), (4, 6, 7, 5, 2), (6, 7, 5, 2, 4), (6, 4, 7, 5, 3), (6, 5, 4, 2, 3), (4, 2, 3, 5, 7), (5, 6, 2, 7, 4), (4, 5, 2, 6), (6, 3, 5, 4), (7, 2, 5, 4, 3), (3, 6, 4, 2), (9, 4), (6, 2, 3, 5, 4), (4, 6, 5, 3, 2), (6, 3, 5, 2), (2, 5, 4, 6), (7, 6, 4, 3, 2), (7, 5, 3, 4, 2), (7, 4, 2, 5, 3), (2, 7, 3, 4), (5, 6, 2, 3, 7), (7, 2, 5, 6), (4, 3, 2, 7, 6), (5, 6, 4, 3), (4, 7, 6, 3, 5), (3, 4, 2, 7, 6), (2, 6, 7, 4), (2, 5, 7, 6, 4), (4, 3, 6, 5, 2), (2, 6, 3, 5), (7, 6, 4, 2), (4, 6, 7, 3, 2), (3, 6), (6, 7, 3, 2), (7, 2, 4, 6, 3), (6, 2, 5, 7), (3, 2, 5, 6, 7), (5, 7, 6, 2), (5, 6, 4, 3, 7), (6, 4, 3, 7, 5), (5, 4), (6, 5, 4, 3, 2), (7, 5, 6, 2, 3), (6, 2, 4, 5, 7), (7, 3, 5, 4, 6), (2, 6, 4, 3, 5), (3, 5, 2, 7, 4), (5, 3, 4, 7, 6), (2, 3, 4, 6), (4, 2, 5), (4, 6, 3, 5), (5, 3, 7, 4, 6), (6, 7, 5, 4, 3), (6, 4, 7, 3, 2), (4, 2, 5, 3, 6), (4, 5, 6), (5, 2, 6, 4, 7), (3, 6, 7, 5), (6, 3, 4, 2, 5), (6, 5, 7, 3, 4), (5, 6, 3, 4, 2), (3, 2, 6, 5, 4), (2, 5, 7, 4, 6), (2, 3, 4, 5, 7), (3, 5, 4, 7), (4, 2, 7, 3, 6), (5, 2, 4), (4, 5, 3, 2), (2, 7, 5, 3, 6), (4, 2, 5, 3), (6, 4, 2, 7), (2, 5, 4, 3, 7), (2, 5, 7, 6, 3), (3, 5, 4), (3, 2, 5, 7, 4), (7, 2, 6, 4, 5), (4, 3, 5, 7, 6), (3, 2, 6, 4, 5), (7, 6, 5, 4), (6, 2, 4, 5), (2, 4, 5, 3), (2, 7, 3), (2, 5, 6, 3, 7), (3, 7, 5), (6, 2), (6, 2, 4, 3), (5, 3, 4, 6), (7, 5, 6, 2), (3, 6, 2, 4, 7), (5, 2, 3, 7), (5, 4, 2, 6, 7), (5, 6, 2, 3, 4), (4, 3, 2, 7), (3, 5, 7, 4), (5, 4, 2, 7), (4, 6, 5, 2, 3), (4, 7, 5), (5, 4, 3, 2, 7), (2, 5, 6, 4, 3), (4, 6, 3, 7, 5), (6, 2, 4, 3, 7), (5, 2, 3, 4, 6), (7, 5, 3, 6, 2), (3, 7, 2, 5), (2, 3, 4, 5, 6), (5, 4, 2, 7, 3), (3, 2, 7, 6, 5), (2, 6, 4), (7, 4, 2), (7, 5, 3, 2, 4), (6, 2, 7, 3, 5), (5, 2, 7, 4), (4, 6, 2, 5), (7, 4, 3, 2, 6), (2, 4, 6, 5, 3), (4, 7, 5, 6), (2, 7, 5, 3), (7, 3, 6, 4, 5), (6, 5, 2), (2, 5, 7, 3, 6), (5, 3, 2, 6, 4), (3, 6, 7, 2, 4), (6, 4, 5, 3), (6, 2, 7, 4, 5), (6, 4, 5, 3, 7), (2, 3), (3, 6, 5, 4, 2), (2, 5, 6), (5, 6, 2, 3), (2, 3, 7, 6, 5), (6, 3, 2, 7, 4), (6, 5, 2, 4, 3), (6, 2, 7, 4), (6, 4, 2, 5, 7), (6, 5), (5, 6, 4, 3, 2), (6, 2, 3, 5), (4, 6, 5, 3), (4, 3, 5, 6, 2), (5, 4, 7, 6, 2), (5, 4, 7, 6), (7, 3, 2, 4, 5), (6, 5, 4, 7, 3), (4, 2, 3, 6, 7), (2, 5, 6, 4, 7), (3, 6, 5, 2), (6, 7, 4, 3, 5), (2, 3, 7, 6), (6, 3, 2), (4, 3, 7), (2, 5, 4, 7, 6), (3, 6, 5, 4), (3, 7, 2, 6), (2, 6, 5, 4, 3), (4, 2, 7, 5, 3), (6, 5, 2, 3), (6, 2, 3, 7, 4), (3, 5, 2, 6, 7), (5, 6, 2, 4, 7), (2, 7, 5, 3, 4), (6, 7, 5, 3), (2, 7, 3, 4, 5), (5, 4, 3, 7), (7, 4, 6, 5, 2), (2, 5, 7, 3, 4), (3, 5, 7, 2, 6), (5, 3, 2, 4), (7, 5, 4, 3, 2), (6, 7, 5, 3, 2), (4, 3, 7, 6, 2), (2, 4, 6, 5, 7), (4, 3, 7, 2), (5, 7, 3, 4, 2), (6, 3, 4, 7), (5, 6, 7, 2), (6, 2, 5), (2, 6, 7, 5, 3), (5, 6, 7), (7, 4, 5, 2, 3), (5, 3, 6, 7, 4), (3, 6, 2, 7, 5), (2, 3, 6, 5, 4), (6, 4, 7, 2, 3), (6, 3, 5, 7, 4), (7, 2, 6, 5, 3), (7, 4, 2, 3), (3, 2, 4, 7), (5, 4, 2), (4, 7, 2, 5), (2, 4, 5), (2, 5, 6, 7, 4), (5, 7, 2, 3, 6), (3, 6, 7), (4, 3, 5, 2, 6), (5, 7, 6, 2, 3), (4, 7, 2, 3), (6, 2, 4, 7, 3), (3, 4, 6, 5, 2), (5, 6, 3, 7, 4), (3, 6, 2, 7), (3, 5, 7, 6, 4), (2, 3, 6, 7, 4), (3, 2, 7, 5, 6), (3, 4, 5, 7), (7, 3, 4, 2, 6), (5, 7, 3, 2), (2, 3, 5, 6, 7), (4, 2, 7, 5, 6), (3, 5, 4, 6, 7), (7, 3, 6, 5), (3, 6, 2, 7, 4), (6, 5, 3, 7), (3, 6, 2, 4, 5), (4, 5, 6, 2), (4, 5, 3, 7, 2), (4, 5, 7), (7, 3, 4, 5, 2), (3, 5, 4, 2, 6), (5, 7, 6, 4, 3), (2, 5, 4, 3), (3, 7, 5, 6, 2), (7, 5, 2, 3, 4), (6, 5, 7, 2), (4, 7, 2), (3, 9), (3, 7, 4, 5), (6, 2, 4, 3, 5), (4, 3), (7, 4, 2, 5), (6, 4, 3, 2), (5, 6, 4, 7, 2), (5, 2), (4, 3, 9), (5, 6, 4, 2), (5, 2, 6, 4, 3), (5, 3, 6, 2, 7), (2, 5, 6, 4), (4, 7, 6, 2, 3), (2, 6, 3, 4), (7, 3, 5, 6), (7, 2, 3), (4, 7, 5, 2, 3), (3, 4, 5, 2, 6), (4, 2, 6, 3), (3, 5, 6, 7, 2), (4, 5, 6, 7, 2), (7, 4, 2, 6, 5), (2, 7, 4), (4, 2, 3, 7, 5), (3, 7, 4), (2, 4, 6, 5), (7, 4, 3, 2, 5), (4, 7, 3, 5), (6, 7, 4, 5, 2), (4, 3, 7, 2, 6), (3, 6, 5, 7, 2), (3, 5, 7, 2, 4), (2, 4, 6, 3), (7, 5, 3, 2), (4, 6, 3, 5, 7), (2, 3, 5, 4), (4, 3, 5, 7, 2), (3, 2, 7, 4, 5), (5, 7, 2, 6), (4, 2, 5, 7, 3), (4, 6, 3, 2), (2, 6, 5, 7, 4), (1, 5), (3, 5, 4, 2), (5, 2, 7, 6, 4), (4, 7, 3, 6, 2), (2, 6, 3), (7, 4, 3), (6, 3, 2, 5), (4, 2, 3, 6, 5), (2, 6), (2, 7, 4, 6), (2, 6, 5, 4), (5, 2, 7, 4, 6), (2, 7, 3, 5, 6), (4, 6, 3, 2, 7), (5, 7, 2, 3, 4), (7, 2, 6, 5), (2, 3, 7, 5, 6), (6, 5, 3), (6, 2, 4, 7, 5), (7, 5), (7, 2, 6, 3), (4, 3, 5, 2, 7), (2, 6, 4, 5, 7), (3, 5, 7, 6, 2), (5, 3, 2), (5, 6, 7, 4, 2), (2, 5, 7), (3, 5, 6, 2, 4), (3, 2, 7, 4, 6), (2, 3, 5, 4, 7), (2, 3, 6, 7), (7, 6, 5, 3, 4), (7, 6, 3, 2, 5), (4, 5, 2, 3, 7), (7, 5, 4), (6, 5, 7, 2, 3), (5, 4, 6, 3), (7, 3, 4, 2), (5, 3, 4, 7), (5, 4, 2, 3, 6), (7, 5, 6, 3), (5, 2, 3, 4), (2, 3, 9), (5, 4, 2, 6), (3, 4, 5), (4, 7, 2, 5, 6), (3, 6, 4, 5, 2), (3, 2, 6, 7, 4), (6, 4, 2, 5, 3), (2, 7, 4, 5, 3), (4, 5, 6, 2, 3), (4, 6, 5, 7, 2), (7, 5, 2, 6), (6, 4, 5, 7, 3), (6, 3, 7, 4), (5, 2, 7, 3), (2, 5, 3, 7, 6), (2, 1), (5, 2, 6, 3, 7), (2, 7, 5, 6), (7, 2, 3, 4), (2, 6, 4, 7, 5), (2, 3, 7, 4, 6), (3, 4, 5, 6, 7), (4, 6, 3, 5, 2), (4, 5, 6, 3, 7), (3, 6, 7, 4, 2), (7, 2), (5, 3, 7, 4), (2, 4, 7, 5, 6), (6, 4, 5, 2), (6, 2, 4), (4, 3, 6, 2, 7), (5, 6, 2, 4, 3), (4, 2, 5, 3, 7), (2, 4, 7, 3, 6), (2, 5, 6, 7), (7, 2, 5, 6, 3), (2, 6, 7, 4, 3), (2, 6, 5, 3), (2, 6, 5, 3, 7), (2, 5, 4, 3, 6), (4, 6, 7, 3, 5), (5, 2, 3, 6, 4), (5, 6, 7, 2, 3), (6, 5, 7, 4, 2), (6, 2, 3, 4), (5, 4, 3), (4, 6, 5, 2), (7, 2, 6, 4, 3), (6, 4, 3, 5, 2), (2, 7, 4, 6, 3), (3, 6, 4), (6, 3, 4, 7, 2), (7, 5, 2, 6, 4), (4, 5, 2, 7, 3), (3, 4, 2, 6, 5), (3, 4, 7, 2, 6), (4, 2, 5, 6, 7), (5, 3, 4, 6, 2), (3, 7, 5, 2, 6), (4, 7, 5, 6, 3), (4, 3, 7, 2, 5), (3, 6, 2, 5, 4), (6, 5, 3, 2, 7), (3, 4, 2, 6, 7), (3, 4, 6, 7, 2), (3, 7, 6, 2, 5), (3, 5, 2), (6, 3, 2, 4, 5), (6, 7, 4, 2, 3), (2, 3, 7, 5, 4), (3, 5), (4, 2, 7), (5, 2, 4, 7), (4, 5, 2, 7, 6), (4, 6), (2, 3, 7, 5), (7, 2, 4, 6), (5, 7), (3, 2, 5, 4, 6), (5, 4, 6, 3, 2), (4, 5, 7, 6, 2), (5, 2, 4, 7, 3), (5, 6, 7, 3), (4, 2, 3, 5), (7, 2, 4, 3), (4, 7, 3), (4, 7, 5, 2, 6), (7, 6, 2, 3), (5, 2, 6), (7, 2, 4, 5, 6), (2, 6, 3, 4, 7), (2, 5, 7, 3), (4, 3, 7, 5, 6), (6, 4, 5, 2, 3), (2, 6, 4, 7), (7, 4, 3, 5, 2), (7, 3, 2, 5), (5, 2, 7, 4, 3), (5, 2, 6, 7, 3), (4, 7, 2, 3, 6), (3, 7, 2, 6, 5), (3, 2, 6, 4, 7), (3, 4, 7, 5, 6), (5, 4, 3, 2), (2, 3, 6, 7, 5), (3, 4, 5, 2), (2, 5, 7, 4, 3), (2, 3, 4, 5), (2, 7, 5), (5, 4, 6, 2, 3), (3, 7, 2, 6, 4), (4, 3, 6, 2, 5), (2, 4, 7, 6), (3, 5, 6, 7), (2, 4, 3, 7), (2, 6, 7, 3, 5), (6, 2, 3, 4, 7), (6, 5, 3, 7, 2), (3, 5, 7, 4, 2), (3, 5, 6, 4), (3, 6, 4, 5, 7), (7, 6, 3, 2), (5, 7, 4, 6, 2), (7, 3, 4, 6, 5), (2, 7, 6, 5, 3), (2, 7, 6, 4, 5), (6, 7, 5, 4), (4, 3, 6, 5, 7), (2, 7, 6, 5), (3, 7, 5, 4), (2, 6, 3, 5, 4), (6, 5, 7, 3), (2, 7, 6, 4), (6, 7, 5, 3, 4), (4, 3, 2, 7, 5), (2, 9, 4), (3, 5, 7, 4, 6), (6, 4, 3, 5), (7, 6, 5, 4, 3), (3, 4, 7, 5, 2), (6, 5, 2, 3, 4), (7, 3, 2, 5, 6), (7, 2, 5, 4), (2, 4, 6, 7, 3), (3, 7, 5, 2, 4), (6, 4, 2, 7, 5), (6, 2, 5, 3), (3, 2, 7, 5, 4), (7, 6, 2, 4, 3), (2, 5, 4), (7, 3, 5, 2, 4), (2, 4, 6, 3, 7), (7, 4, 3, 6), (6, 5, 2, 7, 3), (4, 6, 7, 5, 3), (4, 7, 6, 5, 2), (0, 5), (7, 5, 3), (4, 7, 2, 6, 5), (7, 4, 2, 5, 6), (4, 7, 3, 6), (4, 7, 3, 2, 5), (5, 3, 6, 4, 2), (5, 3, 7, 4, 2), (5, 6, 3, 7, 2), (2, 4), (7, 5, 6, 4, 2), (2, 6, 4, 5, 3), (5, 2, 6, 4), (4, 6, 3, 7), (7, 3, 6, 4, 2), (6, 5, 4, 2), (4, 3, 5), (6, 3, 2, 5, 7), (3, 2, 5), (7, 3, 6, 5, 4), (4, 3, 5, 6), (2, 7, 4, 3), (2, 4, 3, 6, 7), (6, 7, 3, 5, 2), (2, 3, 6, 4, 7), (4, 5, 7, 6, 3), (3, 2, 6, 5), (6, 3, 2, 4), (4, 2, 5, 7), (4, 5, 3, 6, 7), (3, 5, 2, 4, 7), (5, 7, 6), (7, 2, 6, 4), (7, 4, 6, 3), (3, 2, 4, 5, 7), (2, 9, 3), (5, 6, 3, 2, 7), (5, 6, 7, 4), (7, 2, 6, 3, 4), (7, 6, 4, 2, 5), (6, 2, 3), (2, 6, 4, 7, 3), (6, 5, 2, 7, 4), (4, 2, 3, 7, 6), (6, 4, 3), (5, 2, 6, 3, 4), (5, 6, 2, 7, 3), (7, 6, 5, 2), (6, 2, 4, 7), (5, 3, 4, 2), (3, 7, 5, 6, 4), (5, 7, 2, 6, 4), (4, 3, 7, 6), (5, 4, 6, 2), (6, 3, 7, 4, 2), (9, 3), (2, 4, 7), (3, 5, 4, 2, 7), (3, 6, 5), (4, 2, 6, 5, 3), (7, 3, 4, 5, 6), (6, 7, 4, 5), (7, 3, 4, 5), (5, 3, 2, 7, 4), (3, 5, 7, 2), (9, 3, 4), (6, 7, 2, 5, 3), (3, 5, 6, 4, 7), (2, 5, 7, 4), (5, 4, 7, 3, 6), (6, 7, 4, 3), (4, 3, 2, 5), (3, 6, 4, 2, 5), (7, 4, 6, 5), (6, 3, 7, 5), (3, 7, 4, 2, 5), (6, 4, 7, 2, 5), (7, 3, 2, 5, 4), (4, 2, 6), (4, 2, 3, 6), (7, 2, 3, 5), (2, 7, 4, 5, 6), (4, 6, 2, 7), (2, 7, 6, 3, 5), (7, 4, 5, 3, 2), (2, 6, 3, 7, 4), (6, 4, 5, 7), (5, 3, 6, 7, 2), (7, 6, 2, 3, 4), (7, 4, 2, 3, 6), (3, 7, 6, 2), (5, 6, 2, 7), (5, 7, 6, 2, 4), (5, 2, 4, 6, 3), (4, 3, 6, 7, 5), (5, 4, 2, 6, 3), (5, 2, 7), (9, 4, 2), (2, 7, 4, 3, 5), (7, 2, 4, 3, 5), (4, 6, 3, 2, 5), (6, 3, 7, 2, 5), (6, 7, 2), (3, 7, 6, 4, 5), (4, 5, 3, 7, 6), (6, 3, 7, 2, 4), (7, 2, 3, 5, 4), (3, 7), (7, 6, 5, 3, 2), (4, 5, 3, 2, 6), (3, 7, 5, 4, 2), (5, 6, 4, 7, 3), (4, 5, 2, 6, 7), (2, 5, 3, 7, 4), (2, 7, 6), (5, 7, 4, 2), (7, 6, 3, 4), (3, 7, 6), (4, 3, 7, 5, 2), (5, 4, 7, 6, 3), (5, 2, 4, 3, 6), (6, 4, 2, 3, 7), (6, 4, 5, 2, 7), (7, 6, 5, 2, 4), (7, 3, 2, 4), (3, 6, 7, 5, 4), (2, 6, 7, 5, 4), (3, 2, 4, 6), (5, 2, 4, 6), (7, 5, 6, 4, 3), (7, 2, 3, 6, 4), (6, 3, 7, 5, 2), (6, 2, 7, 4, 3), (7, 2, 4, 5), (3, 6, 4, 2, 7), (5, 2, 4, 7, 6), (2, 7, 5, 4, 6), (7, 5, 2, 4, 6), (2, 3, 5, 7, 6), (7, 4, 5), (3, 5, 4, 7, 6), (2, 5, 7, 6), (3, 4, 6, 5, 7), (4, 2, 7, 5), (7, 6, 3, 5, 4), (6, 7, 2, 3), (4, 2, 7, 3), (7, 4, 6, 2, 3), (4, 6, 3), (7, 3, 2, 6), (2, 4, 5, 3, 7), (6, 7, 2, 5), (5, 6, 3, 7), (5, 3, 2, 4, 6), (5, 7, 2, 6, 3), (4, 7, 5, 6, 2), (3, 4, 5, 6, 2), (2, 4, 7, 3), (5, 7, 3, 6), (2, 5, 3, 7), (7, 5, 2), (4, 5, 7, 2, 3), (4, 6, 2, 7, 3), (6, 2, 5, 3, 4), (2, 3, 4), (7, 3, 2), (7, 5, 4, 2), (7, 5, 4, 3, 6), (5, 6, 2), (7, 5, 3, 2, 6), (3, 2, 5, 6), (3, 4, 7), (6, 3, 5, 2, 7), (3, 7, 4, 6, 2), (7, 4, 5, 6, 2), (7, 2, 3, 6, 5), (6, 3, 5), (4, 3, 2), (3, 4, 6, 7, 5), (6, 7, 4, 2, 5), (7, 6, 4), (4, 5, 2, 3), (6, 3, 5, 7), (7, 6, 4, 5, 2), (6, 4, 2, 7, 3), (6, 5, 7, 4), (2, 4, 5, 7, 6), (7, 2, 5, 3), (6, 2, 5, 4, 3), (4, 2, 7, 6, 3), (7, 2, 3, 5, 6), (6, 4, 7, 5), (4, 6, 2, 3, 5), (3, 4, 6, 2), (2, 5, 3, 6), (6, 7, 2, 3, 4), (4, 6, 3, 7, 2), (6, 4, 7, 3), (6, 2, 5, 4, 7), (7, 3, 5, 4), (3, 7, 6, 5, 4), (6, 4, 2), (4, 2, 6, 5), (4, 5, 3, 6, 2), (4, 5, 2), (6, 4), (7, 5, 2, 6, 3), (4, 7, 2, 3, 5), (3, 5, 6, 7, 4), (3, 7, 6, 2, 4), (2, 4, 6, 7), (4, 6, 7, 3), (7, 5, 3, 6), (2, 4, 6), (3, 6, 2), (6, 7, 5, 2, 3), (6, 4, 7, 5, 2), (4, 7, 3, 5, 2), (6, 5, 4, 7), (7, 2, 6, 5, 4), (5, 2, 6, 3), (3, 6, 7, 2), (6, 3, 4, 5, 2), (5, 7, 2, 4), (2, 3, 5, 7, 4), (4, 5, 7, 2), (6, 5, 3, 7, 4), (5, 2, 3, 4, 7), (4, 3, 5, 7), (3, 2, 4, 7, 5), (7, 6, 4, 3, 5), (3, 4, 2, 5, 6), (7, 2, 6), (2, 5, 3, 6, 4), (9, 2), (3, 2, 6, 4), (3, 2, 5, 6, 4), (4, 2, 5, 6), (6, 2, 3, 4, 5), (7, 5, 6, 3, 4), (3, 5, 4, 6, 2), (5, 4, 7, 3, 2), (3, 6, 5, 2, 7), (7, 6, 2, 5, 3), (2, 4, 3, 6), (2, 7, 3, 5, 4), (2, 7, 4, 6, 5), (5, 7, 4, 2, 3), (5, 4, 6, 7, 2), (4, 6, 5, 3, 7), (7, 2, 3, 4, 5), (7, 6, 5, 3), (3, 4, 7, 6), (6, 3, 2, 7, 5), (2, 3, 6, 5), (5, 3, 4), (3, 4, 5, 7, 6), (7, 2, 6, 3, 5), (6, 7, 3), (5, 4, 6, 2, 7), (6, 7, 5, 4, 2), (6, 4, 7, 3, 5), (7, 3, 2, 4, 6), (5, 2, 6, 7, 4), (4, 2, 9), (7, 6, 2, 5, 4), (2, 6, 4, 3, 7), (6, 7, 4, 2), (9, 3, 2), (4, 3, 6, 5), (2, 4, 7, 5, 3), (7, 5, 2, 4), (6, 3, 7, 2), (4, 2, 7, 6, 5), (6, 2, 3, 7, 5), (3, 2, 7, 4), (3, 7, 6, 4, 2), (4, 6, 2, 3, 7), (7, 2, 3, 6), (3, 7, 5, 4, 6), (5, 7, 2, 4, 6), (4, 3, 2, 5, 6), (5, 0), (7, 3, 5), (3, 6, 4, 7, 5), (2, 3, 7, 4), (5, 3, 7, 2), (4, 2, 5, 6, 3), (2, 5, 6, 3), (5, 2, 4, 6, 7), (4, 5, 7, 2, 6), (7, 4, 6), (3, 6, 7, 2, 5), (4, 3, 2, 5, 7), (5, 4, 3, 6, 7), (4, 2), (2, 4, 7, 6, 5), (7, 4, 5, 2), (5, 3), (4, 2, 6, 3, 7), (2, 4, 9), (3, 5, 2, 6), (3, 4, 2, 5, 7), (6, 3, 5, 4, 7), (4, 5, 3, 2, 7), (4, 6, 2), (0, 1), (7, 2, 3, 4, 6), (2, 3, 5, 4, 6), (5, 4, 3, 2, 6), (5, 3, 7), (4, 7, 6, 3, 2), (3, 5, 4, 7, 2), (3, 7, 4, 2), (3, 9, 2), (5, 7, 4, 3, 6), (4, 6, 7, 2, 3), (5, 2, 3, 7, 4), (7, 4, 6, 5, 3), (5, 7, 4, 3), (3, 6, 7, 5, 2), (3, 2, 7, 6, 4), (2, 3, 5), (2, 7, 5, 4, 3), (6, 2, 7, 3, 4), (3, 5, 6, 2, 7), (6, 5, 2, 4), (5, 6, 3), (7, 5, 6, 3, 2), (6, 4, 5), (7, 3, 5, 6, 2), (3, 2, 4, 5), (3, 7, 5, 2), (7, 2, 4, 5, 3), (5, 7, 6, 3, 4), (6, 3, 4, 2), (7, 6, 5), (4, 3, 7, 5), (1, 2), (5, 4, 7, 2, 6), (6, 7, 2, 4, 3), (2, 4, 3, 5, 6), (4, 9), (4, 2, 3, 7), (2, 9), (7, 2, 5, 3, 4), (4, 7, 6, 3), (7, 4, 2, 6), (5, 3, 4, 7, 2), (4, 7, 5, 3, 6), (5, 7, 4), (6, 3), (5, 4, 6, 7, 3), (6, 2, 5, 7, 3), (5, 6, 3, 2), (6, 5, 4, 7, 2), (4, 7, 2, 6), (3, 4, 2, 7), (6, 7, 2, 4), (5, 6, 3, 4), (7, 6, 2, 3, 5), (4, 5, 6, 3, 2), (5, 6, 3, 4, 7), (3, 2, 9), (5, 6, 7, 3, 4), (7, 5, 3, 6, 4), (4, 5, 3), (2, 3, 4, 7), (2, 7, 3, 6), (5, 4, 6), (7, 4, 3, 6, 2), (7, 3, 6, 2), (6, 5, 3, 4), (7, 5, 4, 3), (6, 7, 4, 5, 3), (3, 4, 7, 6, 2), (3, 2, 5, 7), (6, 5, 3, 2), (4, 5, 6, 7), (7, 4, 6, 3, 5), (3, 7, 2, 4, 5), (6, 7, 3, 5, 4), (6, 3, 4, 7, 5), (7, 6, 3, 4, 5), (2, 7, 3, 5), (6, 7, 4), (2, 5, 6, 3, 4), (3, 4, 7, 2, 5), (3, 5, 7), (3, 7, 4, 6), (6, 3, 7, 5, 4), (3, 4, 2, 6), (3, 4, 6, 5), (3, 4, 6, 7), (6, 4, 3, 7), (2, 6, 7, 5)]

0
2017-11-11 17:17



此输出如何满足OP请求的答案? - ᴀʀᴍᴀɴ