Reputation: 485
i am trying to find a more elegant way to do the following:
I have a list, lets say [a b c d e f g h i j]
I want to take permutations of n
elements, in sequence, without skipping and/or rearranging.
E.g. for n=2
the required output would be:
perm=[[a b], [b c], [c d], [d e], [e f] etc...]
or for n=3
:
perm3=[[a b c], [b c d], [c d e], [d e f] etc...]
The code i have now is:
n = 2
perms = []
input_list = [a b c d e f g h]
for it in range(0, len(input_list)):
sliceObj = slice(it, it + n, 1)
k = input_list[sliceObj]
if len(k) == n:
perms.append(k)
is there something simpler/more elegant?
ANSWER: based on @juanpa.arrivillaga 's answer:
perms_n = [input_list[i:i+n] for i in range(0, len(input_list)-(n-1))]
Thanks again @juanpa.arrivillaga and all
Upvotes: 0
Views: 89
Reputation: 2821
EDIT: I had misunderstood the question, this is the correct solution.
from itertools import islice
myList = ['a', 'b', 'c', 'd', 'e']
list(zip(*[islice(myList, s, None) for s in range(3)]))
# [('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e')]
Upvotes: 2
Reputation: 16081
A solution with itertools
,
import itertools
def window(iterable, size):
values = [itertools.islice(iterable, s, None) for s in xrange(size)]
return itertools.izip(*values)
Results
In [38]: print list(window(x,2))
[('a', 'b'), ('b', 'c'), ('c', 'd'), ('d', 'e'), ('e', 'f'), ('f', 'g'), ('g', 'h'), ('h', 'i'), ('i', 'j')]
In [39]: print list(window(x,3))
[('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'), ('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j')]
In [40]: print list(window(x,5))
[('a', 'b', 'c', 'd', 'e'), ('b', 'c', 'd', 'e', 'f'), ('c', 'd', 'e', 'f', 'g'), ('d', 'e', 'f', 'g', 'h'), ('e', 'f', 'g', 'h', 'i'), ('f', 'g', 'h', 'i', 'j')]
Upvotes: 0
Reputation: 96172
>>> n = 1
>>> [x[i:i+n] for i in range(0, len(x)-n+1)]
[['a'], ['b'], ['c'], ['d'], ['e'], ['f'], ['g'], ['h'], ['i'], ['j']]
>>> n=3
>>> [x[i:i+n] for i in range(0, len(x)-n+1)]
[['a', 'b', 'c'], ['b', 'c', 'd'], ['c', 'd', 'e'], ['d', 'e', 'f'], ['e', 'f', 'g'], ['f', 'g', 'h'], ['g', 'h', 'i'], ['h', 'i', 'j']]
>>> n = 4
>>> [x[i:i+n] for i in range(0, len(x)-n+1)]
[['a', 'b', 'c', 'd'], ['b', 'c', 'd', 'e'], ['c', 'd', 'e', 'f'], ['d', 'e', 'f', 'g'], ['e', 'f', 'g', 'h'], ['f', 'g', 'h', 'i'], ['g', 'h', 'i', 'j']]
>>>
So, use the stop parameter to your advantage, using len(x)-n+1
.
Your code doesn't produce permutations, it is a sliding window. In which case, you can make it more elegant. Use the step
parameter to range
, pass the slice using indexing syntactic sugar instead of building a slice object explicitly, and use len(your_list) - 1
as the stop parameter:
>>> x
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
>>> n = 2
>>> [x[i:i+n] for i in range(0, len(x)-1, n)]
[['a', 'b'], ['c', 'd'], ['e', 'f'], ['g', 'h'], ['i', 'j']]
>>> n = 3
>>> [x[i:i+n] for i in range(0, len(x)-1, n)]
[['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']]
Note, when len(seq)
is not divisible by n
, this might not be the behavior you want. In the above example, with n=3
, we swallowed the last part because the division has a remainder of 1. Or consider the following:
>>> n = 4
>>> [x[i:i+n] for i in range(0, len(x)-1, n)]
[['a', 'b', 'c', 'd'], ['e', 'f', 'g', 'h'], ['i', 'j']]
>>> n = 1
>>> [x[i:i+n] for i in range(0, len(x)-1, n)]
[['a'], ['b'], ['c'], ['d'], ['e'], ['f'], ['g'], ['h'], ['i']]
In which case, you may want the more strict but also more clunky:
>>> n = 1
>>> [x[i:i+n] for i in range(0, len(x)-n+1, n)]
[['a'], ['b'], ['c'], ['d'], ['e'], ['f'], ['g'], ['h'], ['i'], ['j']]
>>> n = 4
>>> [x[i:i+n] for i in range(0, len(x)-n+1, n)]
[['a', 'b', 'c', 'd'], ['e', 'f', 'g', 'h']]
Upvotes: 2
Reputation:
from itertools import permutations
list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
temp = input("Enter the number of elements for a sequence \n")
print(list(permutations(list1, int(temp))))
Explanation:
Using permutations of itertools
we can create sequences
Get the number of elements for a sequence
temp = input("Enter the number of elements for a sequence \n")
print the sequences
print(list(permutations(list1, int(temp))))
Output: For temp:2
[('a', 'b'), ('a', 'c'), ('a', 'd'), ('a', 'e'), ('a', 'f'), ('a', 'g'), ('a', 'h'), ('a', 'i'), ('a', 'j'), ('b', 'a'), ('b', 'c'), ('b', 'd'), ('b', 'e'), ('b', 'f'), ('b', 'g'), ('b', 'h'), ('b', 'i'), ('b', 'j'), ('c', 'a'), ('c', 'b'), ('c', 'd'), ('c', 'e'), ('c', 'f'), ('c', 'g'), ('c', 'h'), ('c', 'i'), ('c', 'j'), ('d', 'a'), ('d', 'b'), ('d', 'c'), ('d', 'e'), ('d', 'f'), ('d', 'g'), ('d', 'h'), ('d', 'i'), ('d', 'j'), ('e', 'a'), ('e', 'b'), ('e', 'c'), ('e', 'd'), ('e', 'f'), ('e', 'g'), ('e', 'h'), ('e', 'i'), ('e', 'j'), ('f', 'a'), ('f', 'b'), ('f', 'c'), ('f', 'd'), ('f', 'e'), ('f', 'g'), ('f', 'h'), ('f', 'i'), ('f', 'j'), ('g', 'a'), ('g', 'b'), ('g', 'c'), ('g', 'd'), ('g', 'e'), ('g', 'f'), ('g', 'h'), ('g', 'i'), ('g', 'j'), ('h', 'a'), ('h', 'b'), ('h', 'c'), ('h', 'd'), ('h', 'e'), ('h', 'f'), ('h', 'g'), ('h', 'i'), ('h', 'j'), ('i', 'a'), ('i', 'b'), ('i', 'c'), ('i', 'd'), ('i', 'e'), ('i', 'f'), ('i', 'g'), ('i', 'h'), ('i', 'j'), ('j', 'a'), ('j', 'b'), ('j', 'c'), ('j', 'd'), ('j', 'e'), ('j', 'f'), ('j', 'g'), ('j', 'h'), ('j', 'i')]
For temp : 3
[('a', 'b', 'c'), ('a', 'b', 'd'), ('a', 'b', 'e'), ('a', 'b', 'f'), ('a', 'b', 'g'), ('a', 'b', 'h'), ('a', 'b', 'i'), ('a', 'b', 'j'), ('a', 'c', 'b'), ('a', 'c', 'd'), ('a', 'c', 'e'), ('a', 'c', 'f'), ('a', 'c', 'g'), ('a', 'c', 'h'), ('a', 'c', 'i'), ('a', 'c', 'j'), ('a', 'd', 'b'), ('a', 'd', 'c'), ('a', 'd', 'e'), ('a', 'd', 'f'), ('a', 'd', 'g'), ('a', 'd', 'h'), ('a', 'd', 'i'), ('a', 'd', 'j'), ('a', 'e', 'b'), ('a', 'e', 'c'), ('a', 'e', 'd'), ('a', 'e', 'f'), ('a', 'e', 'g'), ('a', 'e', 'h'), ('a', 'e', 'i'), ('a', 'e', 'j'), ('a', 'f', 'b'), ('a', 'f', 'c'), ('a', 'f', 'd'), ('a', 'f', 'e'), ('a', 'f', 'g'), ('a', 'f', 'h'), ('a', 'f', 'i'), ('a', 'f', 'j'), ('a', 'g', 'b'), ('a', 'g', 'c'), ('a', 'g', 'd'), ('a', 'g', 'e'), ('a', 'g', 'f'), ('a', 'g', 'h'), ('a', 'g', 'i'), ('a', 'g', 'j'), ('a', 'h', 'b'), ('a', 'h', 'c'), ('a', 'h', 'd'), ('a', 'h', 'e'), ('a', 'h', 'f'), ('a', 'h', 'g'), ('a', 'h', 'i'), ('a', 'h', 'j'), ('a', 'i', 'b'), ('a', 'i', 'c'), ('a', 'i', 'd'), ('a', 'i', 'e'), ('a', 'i', 'f'), ('a', 'i', 'g'), ('a', 'i', 'h'), ('a', 'i', 'j'), ('a', 'j', 'b'), ('a', 'j', 'c'), ('a', 'j', 'd'), ('a', 'j', 'e'), ('a', 'j', 'f'), ('a', 'j', 'g'), ('a', 'j', 'h'), ('a', 'j', 'i'), ('b', 'a', 'c'), ('b', 'a', 'd'), ('b', 'a', 'e'), ('b', 'a', 'f'), ('b', 'a', 'g'), ('b', 'a', 'h'), ('b', 'a', 'i'), ('b', 'a', 'j'), ('b', 'c', 'a'), ('b', 'c', 'd'), ('b', 'c', 'e'), ('b', 'c', 'f'), ('b', 'c', 'g'), ('b', 'c', 'h'), ('b', 'c', 'i'), ('b', 'c', 'j'), ('b', 'd', 'a'), ('b', 'd', 'c'), ('b', 'd', 'e'), ('b', 'd', 'f'), ('b', 'd', 'g'), ('b', 'd', 'h'), ('b', 'd', 'i'), ('b', 'd', 'j'), ('b', 'e', 'a'), ('b', 'e', 'c'), ('b', 'e', 'd'), ('b', 'e', 'f'), ('b', 'e', 'g'), ('b', 'e', 'h'), ('b', 'e', 'i'), ('b', 'e', 'j'), ('b', 'f', 'a'), ('b', 'f', 'c'), ('b', 'f', 'd'), ('b', 'f', 'e'), ('b', 'f', 'g'), ('b', 'f', 'h'), ('b', 'f', 'i'), ('b', 'f', 'j'), ('b', 'g', 'a'), ('b', 'g', 'c'), ('b', 'g', 'd'), ('b', 'g', 'e'), ('b', 'g', 'f'), ('b', 'g', 'h'), ('b', 'g', 'i'), ('b', 'g', 'j'), ('b', 'h', 'a'), ('b', 'h', 'c'), ('b', 'h', 'd'), ('b', 'h', 'e'), ('b', 'h', 'f'), ('b', 'h', 'g'), ('b', 'h', 'i'), ('b', 'h', 'j'), ('b', 'i', 'a'), ('b', 'i', 'c'), ('b', 'i', 'd'), ('b', 'i', 'e'), ('b', 'i', 'f'), ('b', 'i', 'g'), ('b', 'i', 'h'), ('b', 'i', 'j'), ('b', 'j', 'a'), ('b', 'j', 'c'), ('b', 'j', 'd'), ('b', 'j', 'e'), ('b', 'j', 'f'), ('b', 'j', 'g'), ('b', 'j', 'h'), ('b', 'j', 'i'), ('c', 'a', 'b'), ('c', 'a', 'd'), ('c', 'a', 'e'), ('c', 'a', 'f'), ('c', 'a', 'g'), ('c', 'a', 'h'), ('c', 'a', 'i'), ('c', 'a', 'j'), ('c', 'b', 'a'), ('c', 'b', 'd'), ('c', 'b', 'e'), ('c', 'b', 'f'), ('c', 'b', 'g'), ('c', 'b', 'h'), ('c', 'b', 'i'), ('c', 'b', 'j'), ('c', 'd', 'a'), ('c', 'd', 'b'), ('c', 'd', 'e'), ('c', 'd', 'f'), ('c', 'd', 'g'), ('c', 'd', 'h'), ('c', 'd', 'i'), ('c', 'd', 'j'), ('c', 'e', 'a'), ('c', 'e', 'b'), ('c', 'e', 'd'), ('c', 'e', 'f'), ('c', 'e', 'g'), ('c', 'e', 'h'), ('c', 'e', 'i'), ('c', 'e', 'j'), ('c', 'f', 'a'), ('c', 'f', 'b'), ('c', 'f', 'd'), ('c', 'f', 'e'), ('c', 'f', 'g'), ('c', 'f', 'h'), ('c', 'f', 'i'), ('c', 'f', 'j'), ('c', 'g', 'a'), ('c', 'g', 'b'), ('c', 'g', 'd'), ('c', 'g', 'e'), ('c', 'g', 'f'), ('c', 'g', 'h'), ('c', 'g', 'i'), ('c', 'g', 'j'), ('c', 'h', 'a'), ('c', 'h', 'b'), ('c', 'h', 'd'), ('c', 'h', 'e'), ('c', 'h', 'f'), ('c', 'h', 'g'), ('c', 'h', 'i'), ('c', 'h', 'j'), ('c', 'i', 'a'), ('c', 'i', 'b'), ('c', 'i', 'd'), ('c', 'i', 'e'), ('c', 'i', 'f'), ('c', 'i', 'g'), ('c', 'i', 'h'), ('c', 'i', 'j'), ('c', 'j', 'a'), ('c', 'j', 'b'), ('c', 'j', 'd'), ('c', 'j', 'e'), ('c', 'j', 'f'), ('c', 'j', 'g'), ('c', 'j', 'h'), ('c', 'j', 'i'), ('d', 'a', 'b'), ('d', 'a', 'c'), ('d', 'a', 'e'), ('d', 'a', 'f'), ('d', 'a', 'g'), ('d', 'a', 'h'), ('d', 'a', 'i'), ('d', 'a', 'j'), ('d', 'b', 'a'), ('d', 'b', 'c'), ('d', 'b', 'e'), ('d', 'b', 'f'), ('d', 'b', 'g'), ('d', 'b', 'h'), ('d', 'b', 'i'), ('d', 'b', 'j'), ('d', 'c', 'a'), ('d', 'c', 'b'), ('d', 'c', 'e'), ('d', 'c', 'f'), ('d', 'c', 'g'), ('d', 'c', 'h'), ('d', 'c', 'i'), ('d', 'c', 'j'), ('d', 'e', 'a'), ('d', 'e', 'b'), ('d', 'e', 'c'), ('d', 'e', 'f'), ('d', 'e', 'g'), ('d', 'e', 'h'), ('d', 'e', 'i'), ('d', 'e', 'j'), ('d', 'f', 'a'), ('d', 'f', 'b'), ('d', 'f', 'c'), ('d', 'f', 'e'), ('d', 'f', 'g'), ('d', 'f', 'h'), ('d', 'f', 'i'), ('d', 'f', 'j'), ('d', 'g', 'a'), ('d', 'g', 'b'), ('d', 'g', 'c'), ('d', 'g', 'e'), ('d', 'g', 'f'), ('d', 'g', 'h'), ('d', 'g', 'i'), ('d', 'g', 'j'), ('d', 'h', 'a'), ('d', 'h', 'b'), ('d', 'h', 'c'), ('d', 'h', 'e'), ('d', 'h', 'f'), ('d', 'h', 'g'), ('d', 'h', 'i'), ('d', 'h', 'j'), ('d', 'i', 'a'), ('d', 'i', 'b'), ('d', 'i', 'c'), ('d', 'i', 'e'), ('d', 'i', 'f'), ('d', 'i', 'g'), ('d', 'i', 'h'), ('d', 'i', 'j'), ('d', 'j', 'a'), ('d', 'j', 'b'), ('d', 'j', 'c'), ('d', 'j', 'e'), ('d', 'j', 'f'), ('d', 'j', 'g'), ('d', 'j', 'h'), ('d', 'j', 'i'), ('e', 'a', 'b'), ('e', 'a', 'c'), ('e', 'a', 'd'), ('e', 'a', 'f'), ('e', 'a', 'g'), ('e', 'a', 'h'), ('e', 'a', 'i'), ('e', 'a', 'j'), ('e', 'b', 'a'), ('e', 'b', 'c'), ('e', 'b', 'd'), ('e', 'b', 'f'), ('e', 'b', 'g'), ('e', 'b', 'h'), ('e', 'b', 'i'), ('e', 'b', 'j'), ('e', 'c', 'a'), ('e', 'c', 'b'), ('e', 'c', 'd'), ('e', 'c', 'f'), ('e', 'c', 'g'), ('e', 'c', 'h'), ('e', 'c', 'i'), ('e', 'c', 'j'), ('e', 'd', 'a'), ('e', 'd', 'b'), ('e', 'd', 'c'), ('e', 'd', 'f'), ('e', 'd', 'g'), ('e', 'd', 'h'), ('e', 'd', 'i'), ('e', 'd', 'j'), ('e', 'f', 'a'), ('e', 'f', 'b'), ('e', 'f', 'c'), ('e', 'f', 'd'), ('e', 'f', 'g'), ('e', 'f', 'h'), ('e', 'f', 'i'), ('e', 'f', 'j'), ('e', 'g', 'a'), ('e', 'g', 'b'), ('e', 'g', 'c'), ('e', 'g', 'd'), ('e', 'g', 'f'), ('e', 'g', 'h'), ('e', 'g', 'i'), ('e', 'g', 'j'), ('e', 'h', 'a'), ('e', 'h', 'b'), ('e', 'h', 'c'), ('e', 'h', 'd'), ('e', 'h', 'f'), ('e', 'h', 'g'), ('e', 'h', 'i'), ('e', 'h', 'j'), ('e', 'i', 'a'), ('e', 'i', 'b'), ('e', 'i', 'c'), ('e', 'i', 'd'), ('e', 'i', 'f'), ('e', 'i', 'g'), ('e', 'i', 'h'), ('e', 'i', 'j'), ('e', 'j', 'a'), ('e', 'j', 'b'), ('e', 'j', 'c'), ('e', 'j', 'd'), ('e', 'j', 'f'), ('e', 'j', 'g'), ('e', 'j', 'h'), ('e', 'j', 'i'), ('f', 'a', 'b'), ('f', 'a', 'c'), ('f', 'a', 'd'), ('f', 'a', 'e'), ('f', 'a', 'g'), ('f', 'a', 'h'), ('f', 'a', 'i'), ('f', 'a', 'j'), ('f', 'b', 'a'), ('f', 'b', 'c'), ('f', 'b', 'd'), ('f', 'b', 'e'), ('f', 'b', 'g'), ('f', 'b', 'h'), ('f', 'b', 'i'), ('f', 'b', 'j'), ('f', 'c', 'a'), ('f', 'c', 'b'), ('f', 'c', 'd'), ('f', 'c', 'e'), ('f', 'c', 'g'), ('f', 'c', 'h'), ('f', 'c', 'i'), ('f', 'c', 'j'), ('f', 'd', 'a'), ('f', 'd', 'b'), ('f', 'd', 'c'), ('f', 'd', 'e'), ('f', 'd', 'g'), ('f', 'd', 'h'), ('f', 'd', 'i'), ('f', 'd', 'j'), ('f', 'e', 'a'), ('f', 'e', 'b'), ('f', 'e', 'c'), ('f', 'e', 'd'), ('f', 'e', 'g'), ('f', 'e', 'h'), ('f', 'e', 'i'), ('f', 'e', 'j'), ('f', 'g', 'a'), ('f', 'g', 'b'), ('f', 'g', 'c'), ('f', 'g', 'd'), ('f', 'g', 'e'), ('f', 'g', 'h'), ('f', 'g', 'i'), ('f', 'g', 'j'), ('f', 'h', 'a'), ('f', 'h', 'b'), ('f', 'h', 'c'), ('f', 'h', 'd'), ('f', 'h', 'e'), ('f', 'h', 'g'), ('f', 'h', 'i'), ('f', 'h', 'j'), ('f', 'i', 'a'), ('f', 'i', 'b'), ('f', 'i', 'c'), ('f', 'i', 'd'), ('f', 'i', 'e'), ('f', 'i', 'g'), ('f', 'i', 'h'), ('f', 'i', 'j'), ('f', 'j', 'a'), ('f', 'j', 'b'), ('f', 'j', 'c'), ('f', 'j', 'd'), ('f', 'j', 'e'), ('f', 'j', 'g'), ('f', 'j', 'h'), ('f', 'j', 'i'), ('g', 'a', 'b'), ('g', 'a', 'c'), ('g', 'a', 'd'), ('g', 'a', 'e'), ('g', 'a', 'f'), ('g', 'a', 'h'), ('g', 'a', 'i'), ('g', 'a', 'j'), ('g', 'b', 'a'), ('g', 'b', 'c'), ('g', 'b', 'd'), ('g', 'b', 'e'), ('g', 'b', 'f'), ('g', 'b', 'h'), ('g', 'b', 'i'), ('g', 'b', 'j'), ('g', 'c', 'a'), ('g', 'c', 'b'), ('g', 'c', 'd'), ('g', 'c', 'e'), ('g', 'c', 'f'), ('g', 'c', 'h'), ('g', 'c', 'i'), ('g', 'c', 'j'), ('g', 'd', 'a'), ('g', 'd', 'b'), ('g', 'd', 'c'), ('g', 'd', 'e'), ('g', 'd', 'f'), ('g', 'd', 'h'), ('g', 'd', 'i'), ('g', 'd', 'j'), ('g', 'e', 'a'), ('g', 'e', 'b'), ('g', 'e', 'c'), ('g', 'e', 'd'), ('g', 'e', 'f'), ('g', 'e', 'h'), ('g', 'e', 'i'), ('g', 'e', 'j'), ('g', 'f', 'a'), ('g', 'f', 'b'), ('g', 'f', 'c'), ('g', 'f', 'd'), ('g', 'f', 'e'), ('g', 'f', 'h'), ('g', 'f', 'i'), ('g', 'f', 'j'), ('g', 'h', 'a'), ('g', 'h', 'b'), ('g', 'h', 'c'), ('g', 'h', 'd'), ('g', 'h', 'e'), ('g', 'h', 'f'), ('g', 'h', 'i'), ('g', 'h', 'j'), ('g', 'i', 'a'), ('g', 'i', 'b'), ('g', 'i', 'c'), ('g', 'i', 'd'), ('g', 'i', 'e'), ('g', 'i', 'f'), ('g', 'i', 'h'), ('g', 'i', 'j'), ('g', 'j', 'a'), ('g', 'j', 'b'), ('g', 'j', 'c'), ('g', 'j', 'd'), ('g', 'j', 'e'), ('g', 'j', 'f'), ('g', 'j', 'h'), ('g', 'j', 'i'), ('h', 'a', 'b'), ('h', 'a', 'c'), ('h', 'a', 'd'), ('h', 'a', 'e'), ('h', 'a', 'f'), ('h', 'a', 'g'), ('h', 'a', 'i'), ('h', 'a', 'j'), ('h', 'b', 'a'), ('h', 'b', 'c'), ('h', 'b', 'd'), ('h', 'b', 'e'), ('h', 'b', 'f'), ('h', 'b', 'g'), ('h', 'b', 'i'), ('h', 'b', 'j'), ('h', 'c', 'a'), ('h', 'c', 'b'), ('h', 'c', 'd'), ('h', 'c', 'e'), ('h', 'c', 'f'), ('h', 'c', 'g'), ('h', 'c', 'i'), ('h', 'c', 'j'), ('h', 'd', 'a'), ('h', 'd', 'b'), ('h', 'd', 'c'), ('h', 'd', 'e'), ('h', 'd', 'f'), ('h', 'd', 'g'), ('h', 'd', 'i'), ('h', 'd', 'j'), ('h', 'e', 'a'), ('h', 'e', 'b'), ('h', 'e', 'c'), ('h', 'e', 'd'), ('h', 'e', 'f'), ('h', 'e', 'g'), ('h', 'e', 'i'), ('h', 'e', 'j'), ('h', 'f', 'a'), ('h', 'f', 'b'), ('h', 'f', 'c'), ('h', 'f', 'd'), ('h', 'f', 'e'), ('h', 'f', 'g'), ('h', 'f', 'i'), ('h', 'f', 'j'), ('h', 'g', 'a'), ('h', 'g', 'b'), ('h', 'g', 'c'), ('h', 'g', 'd'), ('h', 'g', 'e'), ('h', 'g', 'f'), ('h', 'g', 'i'), ('h', 'g', 'j'), ('h', 'i', 'a'), ('h', 'i', 'b'), ('h', 'i', 'c'), ('h', 'i', 'd'), ('h', 'i', 'e'), ('h', 'i', 'f'), ('h', 'i', 'g'), ('h', 'i', 'j'), ('h', 'j', 'a'), ('h', 'j', 'b'), ('h', 'j', 'c'), ('h', 'j', 'd'), ('h', 'j', 'e'), ('h', 'j', 'f'), ('h', 'j', 'g'), ('h', 'j', 'i'), ('i', 'a', 'b'), ('i', 'a', 'c'), ('i', 'a', 'd'), ('i', 'a', 'e'), ('i', 'a', 'f'), ('i', 'a', 'g'), ('i', 'a', 'h'), ('i', 'a', 'j'), ('i', 'b', 'a'), ('i', 'b', 'c'), ('i', 'b', 'd'), ('i', 'b', 'e'), ('i', 'b', 'f'), ('i', 'b', 'g'), ('i', 'b', 'h'), ('i', 'b', 'j'), ('i', 'c', 'a'), ('i', 'c', 'b'), ('i', 'c', 'd'), ('i', 'c', 'e'), ('i', 'c', 'f'), ('i', 'c', 'g'), ('i', 'c', 'h'), ('i', 'c', 'j'), ('i', 'd', 'a'), ('i', 'd', 'b'), ('i', 'd', 'c'), ('i', 'd', 'e'), ('i', 'd', 'f'), ('i', 'd', 'g'), ('i', 'd', 'h'), ('i', 'd', 'j'), ('i', 'e', 'a'), ('i', 'e', 'b'), ('i', 'e', 'c'), ('i', 'e', 'd'), ('i', 'e', 'f'), ('i', 'e', 'g'), ('i', 'e', 'h'), ('i', 'e', 'j'), ('i', 'f', 'a'), ('i', 'f', 'b'), ('i', 'f', 'c'), ('i', 'f', 'd'), ('i', 'f', 'e'), ('i', 'f', 'g'), ('i', 'f', 'h'), ('i', 'f', 'j'), ('i', 'g', 'a'), ('i', 'g', 'b'), ('i', 'g', 'c'), ('i', 'g', 'd'), ('i', 'g', 'e'), ('i', 'g', 'f'), ('i', 'g', 'h'), ('i', 'g', 'j'), ('i', 'h', 'a'), ('i', 'h', 'b'), ('i', 'h', 'c'), ('i', 'h', 'd'), ('i', 'h', 'e'), ('i', 'h', 'f'), ('i', 'h', 'g'), ('i', 'h', 'j'), ('i', 'j', 'a'), ('i', 'j', 'b'), ('i', 'j', 'c'), ('i', 'j', 'd'), ('i', 'j', 'e'), ('i', 'j', 'f'), ('i', 'j', 'g'), ('i', 'j', 'h'), ('j', 'a', 'b'), ('j', 'a', 'c'), ('j', 'a', 'd'), ('j', 'a', 'e'), ('j', 'a', 'f'), ('j', 'a', 'g'), ('j', 'a', 'h'), ('j', 'a', 'i'), ('j', 'b', 'a'), ('j', 'b', 'c'), ('j', 'b', 'd'), ('j', 'b', 'e'), ('j', 'b', 'f'), ('j', 'b', 'g'), ('j', 'b', 'h'), ('j', 'b', 'i'), ('j', 'c', 'a'), ('j', 'c', 'b'), ('j', 'c', 'd'), ('j', 'c', 'e'), ('j', 'c', 'f'), ('j', 'c', 'g'), ('j', 'c', 'h'), ('j', 'c', 'i'), ('j', 'd', 'a'), ('j', 'd', 'b'), ('j', 'd', 'c'), ('j', 'd', 'e'), ('j', 'd', 'f'), ('j', 'd', 'g'), ('j', 'd', 'h'), ('j', 'd', 'i'), ('j', 'e', 'a'), ('j', 'e', 'b'), ('j', 'e', 'c'), ('j', 'e', 'd'), ('j', 'e', 'f'), ('j', 'e', 'g'), ('j', 'e', 'h'), ('j', 'e', 'i'), ('j', 'f', 'a'), ('j', 'f', 'b'), ('j', 'f', 'c'), ('j', 'f', 'd'), ('j', 'f', 'e'), ('j', 'f', 'g'), ('j', 'f', 'h'), ('j', 'f', 'i'), ('j', 'g', 'a'), ('j', 'g', 'b'), ('j', 'g', 'c'), ('j', 'g', 'd'), ('j', 'g', 'e'), ('j', 'g', 'f'), ('j', 'g', 'h'), ('j', 'g', 'i'), ('j', 'h', 'a'), ('j', 'h', 'b'), ('j', 'h', 'c'), ('j', 'h', 'd'), ('j', 'h', 'e'), ('j', 'h', 'f'), ('j', 'h', 'g'), ('j', 'h', 'i'), ('j', 'i', 'a'), ('j', 'i', 'b'), ('j', 'i', 'c'), ('j', 'i', 'd'), ('j', 'i', 'e'), ('j', 'i', 'f'), ('j', 'i', 'g'), ('j', 'i', 'h')]
Upvotes: 0