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

11

假设我有一个类似于以下结构的列表:

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])

当然,这并不能起作用,但我应该如何正式地编写这个代码,或者有更好的方法吗?


2
对于2-combos,这很容易,但是如果你例如查看3是否总是与12一起出现,则问题会更难。 - Willem Van Onsem
列表中的元素是否总是介于1-9之间的整数? - Joe Iddon
是的,总是从1到9的整数,并且2个或更多的整数可能会像@WillemVanOnsem所说的那样一起出现。尽管理想情况下,我希望有一个适用于任何整数而不仅仅是1到9的解决方案。 - doddy
8个回答

5

使用itertools.combinations

一开始我想使用与itertools.combination相关的东西,但是由于它允许从不相邻的list中选择elements,所以它不能用于我设想中的解决方案。

事实证明,在处理非数字输入lists时,itertools.combinations在两种情况下都是必要的。我之前感到困惑,是因为我假设groups必须是adjacent

我认为最好的解决方法是生成可能有效的elements,然后针对sub-listslist检查每个elements是否有效,而不是对list进行某种组合工作并沿着这条路走。

因此,为了检查可能的elements列表是否“有效”,即所有elements是否只出现在一起,我使用了一个简单的if和一个带有内置all()any()函数的生成器来完成此任务。

现在这个方法可行了,需要有一种方法来生成潜在的elements。我只是用了两个嵌套的for-loops——一个iteratingwindowwidth上,另一个在windowstart上。

然后从这里开始,我们只需检查那组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嵌套的for循环 可以组合成一个漂亮的 一行代码 (不确定其他人是否认为这是 Pythonic 的):

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

这段代码与之前的代码作用相同,只是更简短。


由于大家(@Arman)的要求,我已经更新了答案,现在它应该能够适用于除0-9以外的其他元素。这是通过引入一个独特的元素列表(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不应该在任何群组中,因为所有其他元素都在不同的子列表中,所以它永远无法与另一个元素组成一组。


然而,如果整数大于9,则此方法将无效。 - ᴀʀᴍᴀɴ
“虽然理想情况下,我希望能够针对任何整数而不仅仅是 1 到 9 找到解决方案。”OP 说道。 - ᴀʀᴍᴀɴ
没错,不过我个人总是尝试在一般情况下回答问题,而不是限制我的答案在 OP 问题的条件中,因为这个问题将来会被多次看到,解决方案必须回答类似的问题。 - ᴀʀᴍᴀɴ
1
@Arman 我会看看能否改进我的解决方案,使逻辑保持不变,但不受1-9的限制... - Joe Iddon
@thanasisp 我已经更新了答案并且我认为它没问题。 - Joe Iddon
显示剩余6条评论

3
另一种具有默认字典的线性解决方案(元组用于创建可哈希的键):
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]]

很好。不过你可以把条件改成 len(p) >= 2,这样更加通用。 - tobias_k
是的,只需将len(p)==x更改为x个元素。 - B. M.
1
我不这么认为。第一个循环执行N次追加操作。 - B. M.

3
你可以使用集合交集来实现这个操作,对于每组中有三个或更多元素也同样适用:请注意我在6,7组中添加了一个8
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})}

我可以道歉吗? - Shihab Shahriar Khan

3

首先,数据

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)]

2

我现在想到的是暴力解决方法,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代表列表元素数量,M代表最长子列表长度。


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

1
以下解决方案具有线性的O(n)复杂度,其中n是所有列表(展平后)中数字的总数。该代码使用位图表示(借助Python无限数字轻松实现)。例如,如果一个数字出现在list0和list2中但不在list1中,则相应的模式将为...000101。例如,在给定的输入中,值2将具有以下位图模式:100111,值3也是如此。该代码为Python2.x版本。
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
这很酷,但我认为使用collections.defaultdict|=运算符和列表推导式可以使代码更短、更易于理解。 - tobias_k
不是线性的。你正在进行的k位操作每个需要O(k)时间。核心问题在于,位掩码表示法必须在所有零位上花费比特,因此它的大小与最高设置位而不是设置位数成比例。 - user2357112

1
什么是最容易理解的实现方式?
我尽可能地让我的解决方案变得简短。我也尽力优化了它。它适用于任何整数,您可以自行选择。
以下是带有大量注释的代码,这些注释对其进行了解释,以及更多基本的解释:
注意:在下面的代码中,我使用[[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):返回从输入的iterable中选择长度为r的元素组成的元组。例如:

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) 不能成为输出,因为它不满足所需条件。


@ammarx...如果我的语气显得粗鲁或者什么的话,我很抱歉。在给定的例子中,尝试将[6,7]转换为[6,7,3]...我可能是错的... - Shihab Shahriar Khan
@ShihabShahriar 不用担心。但是,如果您有问题,请清楚地描述它,并指明您期望什么以及为什么,这样我们才能努力解决它;我不明白您所说的“尝试将[6,7]转换为[6,7,3]”是什么意思。 - Ammar Alyousfi
2
如果你将 3 添加到 [6,7] 中,那么 3 并不总是与 6 和 7 出现在一起(它也会出现在没有 6 或 7 的列表中),而且它也不再总是与 2 出现在一起了(在 [3,6,7] 中没有 2)。 - tobias_k

0

这更像是一种蛮力解决方案,但它将生成一个大列表,其中包含通过生成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)]

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接