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

时间:2017-11-11 17:05:05

标签: python list list-comprehension

说我有一个列表如下:

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

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

8 个答案:

答案 0 :(得分:5)

使用itertools.combinations

我最初想过使用itertools.combination的内容,但因为这允许来自elements的{​​{1}}彼此不相邻,所以它不会起作用我想到的解决方案。

事实证明,在查看非数字输入list时,在两种情况下都需要lists 。我很困惑因为我认为itertools.combinations必须是groups

我认为最适合这种方式的方法是生成可以工作的可能adjacent,然后针对{elements检查每一个<{1}} {1}}的{​​1}} - 而不是在function上进行某种组合工作并沿着这条路走下去。

因此要检查可能list的{​​{1}}是否“有效”,即如果所有sub-lists仅一起出现,我使用带有生成器的简单list listelements内置elements来完成这部分工作。

现在这个工作正常,需要有一种方法来产生可能发生的潜在if。我刚刚使用两个嵌套all() - 一个any()覆盖functions elements,一个for-loops覆盖iterating width是。

然后,从这里开始,我们只检查window的{​​{1}}是否为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)]] (不确定其他人是否认为它是Pythonic):

2

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

由于受欢迎的需求(nested for-loops),我已更新答案,以便它现在应该适用于除one-liner之外的其他sol = [c for w in range(2, len(els)+1) for c in itertools.combinations(els, w) if valid(c)] 。这是通过引入一个独特的@Arman elements0-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组成一个小组。

答案 1 :(得分:3)

使用默认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. 

现在,如果您查找按nn=2此处)组显示的元素,请输入:

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

答案 2 :(得分:2)

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

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 elementsM = longest sublist

答案 3 :(得分:2)

您可以使用设置交叉点执行此操作,并且每个组还可以很好地处理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})}

答案 4 :(得分:1)

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

我使用了所有可能模式的位图表示(使用python的无限数字)。例如,如果list0list2list1中存在数字,则相应的模式将为...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())

答案 5 :(得分: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):从输入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. 对于每个组合,并且为了在我们的代码输出中(意味着它满足我们的条件),我们要确保每个组合,

    • 此集合中存在(即此组合的项目在此集合中一起出现)
    • 或者存在于此集合中 - &gt;其项目的应出现在相应的列表中


    例如

    让我们从第一个组合中获取(1, 3)。我们遍历组合集:

    对于第一个集,我们可以看到(1, 3)存在于其中,因此我们继续前进。

    对于第二个集,我们可以看到它不存在,所以我们想知道相应列表中是否存在任何项目(即原始列表的第二个列表:[2, 1, 4]):

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

答案 6 :(得分:1)

首先,数据

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

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

我和#34;尤里卡!&#34;当我意识到我不必产生所有配对时,那一刻就来了。相反,我可以将每个数字映射到包含它的所有列表。

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

答案 7 :(得分: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)]