Flattening a list with a nested dictionary - list
I have a list that includes a nested dictionary:
l =[('M', 1, 2, {'t': (2, 1.0)}), ('L', 2, 4, {'b': (4, 0.25), 'fi': (4, 0.75)}),
('J', 4, 5, {'a': (5, 0.2), 'w': (5, 0.2), 'wh': (5, 0.4), 'en': (5, 0.2)}),
('T', 4, 6, {'sl': (6, 0.5), 'f': (6, 0.1), 'pz': (6, 0.17), 'al': (6, 0.1)}),
('P', 5, 5, {'tr': (5, 0.2), 'in': (5, 0.2), 'fa': (5, 0.2), 'if': (5, 0.2)})]
I would like to flat out this list, in order to have a plain list like this:
[('M', 1, 2, 't', 2, 1.0, 'L', 2, 4, 'b', 4, 0.25, 'fi', 4, 0.7),
('J', 4, 5, 'a', 5, 0.2, 'w', 5, 0.2, 'wh', 5, 0.4, 'en', 5, 0.2)]
I tried some flatten functions, but I got confused with how to flatten the dictionary within the list. I am new to python, as you can tell. Could anyone help me with getting around this.
I could only think of below brute force method...
your given iterator:
d =[('M', 1, 2, {'t': (2, 1.0)}), ('L', 2, 4, {'b': (4, 0.25), 'fi': (4, 0.75)}),
('J', 4, 5, {'a': (5, 0.2), 'w': (5, 0.2), 'wh': (5, 0.4), 'en': (5, 0.2)}),
('T', 4, 6, {'sl': (6, 0.5), 'f': (6, 0.1), 'pz': (6, 0.17), 'al': (6, 0.1)}),
('P', 5, 5, {'tr': (5, 0.2), 'in': (5, 0.2), 'fa': (5, 0.2), 'if': (5, 0.2)})]
My solution:
l = [ ]
for item in d:
for i in item:
if type(i) is dict:
for j in i.items():
for p in j:
l.append(p) if not isinstance(p,tuple) else [l.extend(k for k in p)]
else:
l.append(i)
print l
output:
['M', 1, 2, 't', 2, 1.0, 'L', 2, 4, 'fi', 4, 0.75, 'b', 4, 0.25, 'J', 4, 5, 'a', 5, 0.20000000000000001, 'en', 5, 0.20000000000000001, 'w', 5, 0.20000000000000001, 'wh', 5, 0.40000000000000002, 'T', 4, 6, 'pz', 6, 0.17000000000000001, 'f', 6, 0.10000000000000001, 'al', 6, 0.10000000000000001, 'sl', 6, 0.5, 'P', 5, 5, 'fa', 5, 0.20000000000000001, 'if', 5, 0.20000000000000001, 'tr', 5, 0.20000000000000001, 'in', 5, 0.20000000000000001]
Hope this helps :)
Related
WMesh face shading artifacts in OpenCV
I'm using OpenCV v4.4.0 with gcc v10.1 on Ubuntu 18.04.5. This code snippet: using namespace std; using namespace cv; using namespace cv::viz; ...... vector<Vec3f> points{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 1, 0}, {2, 0, 0}, {2, 1, 0}}; vector<int> faces{4, 0, 1, 2, 0, 4, 0, 2, 3, 0, 5, 1, 4, 5, 2, 1}; Viz3d window("Mesh"); WMesh mesh(points, faces); window.setBackgroundColor(Color::gray()); mesh.setColor(Color::indigo()); mesh.setRenderingProperty(OPACITY, 0.4); mesh.setRenderingProperty(SHADING, SHADING_FLAT); mesh.setRenderingProperty(REPRESENTATION, REPRESENTATION_SURFACE); window.showWidget("mesh", mesh); window.spin(); creates and displays this planar mesh: The square on the left is defined as 2 triangles and is shaded uniformly, but the square on the right, which is defined as a single quadrilateral face is not shaded uniformly. Again, the mesh is planar. Why the non-uniformity? It becomes even more non-uniform when I change shading from SHADING_FLAT to SHADING_GOURAUD: Can someone explain what is going on here? I know that quadrilateral faces are converted to triangles, but why the shading is non-uniform? EDIT As noted by Матвей Вислоух in his answer below, I intended to use: vector<int> faces{3, 0, 1, 2, 3, 0, 2, 3, 4, 1, 4, 5, 2}; which properly defines two triangular and one quadrilateral face. This solves the problem of artifacts in the left half, but they still remain in the right half:
vector<int> faces{3, 0, 1, 2, 3, 0, 2, 3, 4, 1, 4, 2, 5}; There is a specific rule how opencv unpacks indices from polygon. if there is a polygon : (5, 1, 4, 5, 2, 0) it consists of 3 triangles: (1,4,5) , (4, 5, 2), (5, 2, 0) OLD: vector faces{4, 0, 1, 2, 0, 4, 0, 2, 3, 0, 5, 1, 4, 5, 2, 1}; This means you draw 3 polygons: 2 quads and 1 pentagon. But by indices I guess that you want to draw 2 triangles, and one quad, so try this: vector faces{3, 0, 1, 2, 3, 0, 2, 3, 4, 1, 4, 5, 2};
Sum of 100 digit numbers
I have two arrays each containing 100 digits.I need to add corresponding digits from units place meaning from the end of the array.If there is a carry it should be added in the next index.It should return another array containing the sum. Here is my code and something seems to be wrong .Help me void sumOf100DigitNumbers(int num1[100], int num2[100], int sum[101]) { int i, j = 100, k; for (i = 99; i >= 0; i--) { if (sum[j] == 1) { } else sum[j] = 0; k = sum[j] + num1[i] + num2[i]; if (k >= 10) { sum[j] = k % 10; sum[j - 1] = 1; } else { sum[j] = k; } j--; } } Method to test it [TestMethod, Timeout(1000)] void Test_sumOf100DigitNumbers2() { int a[100] = {6, 8, 3, 7, 8, 1, 2, 4, 6, 7, 2, 0, 6, 6, 7, 0, 0, 9, 4, 8, 2, 9, 6, 3, 1, 7, 2, 3, 0, 4, 4, 5, 0, 9, 7, 0, 8, 9, 2, 6, 9, 2, 8, 8, 0, 2, 8, 2, 6, 5, 3, 0, 5, 2, 2, 5, 8, 8, 6, 6, 2, 3, 6, 0, 7, 0, 9, 9, 0, 4, 6, 4, 0, 4, 5, 1, 9, 5, 1, 5, 3, 6, 6, 3, 2, 4, 0, 7, 7, 8, 4, 6, 8, 7, 8, 9, 1, 6, 9, 2}; int b[100] = { 4, 1, 4, 1, 5, 0, 1, 8, 4, 5, 9, 7, 6, 2, 2, 0, 1, 7, 2, 5, 0, 3, 6, 9, 0, 8, 7, 3, 0, 2, 7, 8, 6, 5, 7, 3, 6, 8, 4, 2, 9, 2, 4, 8, 2, 1, 1, 0, 6, 6, 2, 7, 2, 8, 9, 7, 2, 4, 2, 2, 7, 6, 0, 7, 2, 3, 8, 4, 2, 5, 4, 7, 1, 8, 9, 9, 7, 0, 3, 2, 5, 1, 9, 7, 1, 0, 0, 0, 2, 1, 1, 5, 9, 0, 0, 1, 6, 6, 9, 7 }; int ans[101] = { 1, 0, 9, 7, 9, 3, 1, 4, 3, 1, 3, 1, 8, 2, 8, 9, 0, 2, 6, 7, 3, 3, 3, 3, 2, 2, 5, 9, 6, 0, 7, 2, 3, 7, 5, 4, 4, 5, 7, 6, 9, 8, 5, 3, 6, 2, 3, 9, 3, 3, 1, 5, 7, 8, 1, 2, 3, 1, 2, 8, 8, 9, 9, 6, 7, 9, 4, 8, 3, 3, 0, 1, 1, 2, 3, 5, 1, 6, 5, 4, 7, 8, 8, 6, 0, 3, 4, 0, 7, 9, 9, 6, 2, 7, 7, 9, 0, 8, 3, 8, 9 }; int c[101]; sumOf100DigitNumbers(a, b, c); Assert::AreEqual(true, areEqualArrays(ans, c, 101), L"sumOf100DigitNumbers() failed", 1, 2); }; but my output is as follows: Output
You never initialize c. This means that its contents are indeterminate. You can't predict what values it will contain. So when you do this: if (sum[j] == 1) If one of those indeterminate values happens to be 1 then you're performing a carry you don't intend on doing. You can initialize it as follows: int c[101] = { 0 }; Then you can remove this entirely: if (sum[j] == 1) { } else sum[j] = 0;
How to get a coefficient matrix in Eigen?
Ok so I want to do this operation in Eigen: float StartMatrix[7][7] = { { 1, 4, 6, 9, 3, 5, 8 }, { 2, 5, 3, 7, 4, 8, 2 }, { 3, 6, 6, 7, 0, 2, 4 }, { 2, 4, 3, 7, 4, 8, 2 }, { 2, 3, 3, 11, 4, 8, 1 }, { 2, 12, 3, 7, 0, 8, 2 }, { 2, 2, 3, 4, 4, 11, 2 } }; float TotalMatrix[7] = { 22, 15, 13, 26, 27, 33, 19 }; float CoMatrix[7][7] = { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 } }; for (int row = 0; row < 7; row++) { for (int col = 0; col < 7; col++) { CoMatrix[row][col] = StartMatrix[row][col] / TotalMatrix[col]; } } Divide each row by just the column in the TotalMatrix. And then I want to subtract the Identity matrix from the CoMatrix in Eigen and get the inverse on that (just to get an idea why I want to do this). Problem is, how do I either perform this operation with Eigen, or somehow get the CoMatrix array into a matrix in Eigen so I can do stuff with it (like getting inverse etc). Thanks!
Your code in Eigen would look something like this (after importing the Eigen namespace, using namespace Eigen;): MatrixXd StartMatrix(7, 7); StartMatrix << 1, 4, 6, 9, 3, 5, 8, 2, 5, 3, 7, 4, 8, 2, 3, 6, 6, 7, 0, 2, 4, 2, 4, 3, 7, 4, 8, 2, 2, 3, 3, 11, 4, 8, 1, 2, 12, 3, 7, 0, 8, 2, 2, 2, 3, 4, 4, 11, 2; VectorXd TotalMatrix(7); TotalMatrix << 22, 15, 13, 26, 27, 33, 19; MatrixXd CoMatrix = MatrixXd::Zero(StartMatrix.rows(), StartMatrix.cols()); CoMatrix = StartMatrix.array() / (TotalMatrix.replicate(1,StartMatrix.cols())).array(); You can continue subtracting the identity matrix with CoMatrix -= MatrixXd::Identity(CoMatrix.rows(), CoMatrix.cols()); or combine it with the previous expression as: CoMatrix = (StartMatrix.array() / (TotalMatrix.replicate(1, StartMatrix.cols())).array()).matrix() - MatrixXd::Identity(CoMatrix.rows(), CoMatrix.cols());
How do I get a UCS code of a 1-byte letter of UTF-8 in C++?
I need to check, whether a letter (in english and russian languages) is alphabetical. A file is supposed to be encoded with UTF-8 by default. I found out, that the best solution is working with UCS codes. The way to calculate UCS-code of 2-bytes encoded letter is #include <stdio.h> #include <stdlib.h> char utf8len[256] = { // len = utf8len[c] & 0x7 cont = utf8len[c] & 0x8 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 - 15 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 16 - 31 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 32 - 47 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 48 - 63 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 80 - 95 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 112 - 127 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 80 - 8f 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 90 - 9f 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // a0 - af 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // b0 - bf 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // c0 - cf 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // d0 - df 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // e0 - ef 4, 4, 4, 4, 4, 4, 4, 4, // f0 - f7 5, 5, 5, 5, // f8, f9, fa, fb 6, 6, // fc, fd 0, 0 // fe, ff }; #define UTF8LEN(c) (utf8len[(unsigned char)(c)] & 0x7) #define UTF8CONT(c) (utf8len[(unsigned char)(c)] & 0x8) int main (int argc, char *argv[]) { char *s = "Б№1АГД"; //string which contains cyrillic symbols while (*s) { int ucode; printf ("[%s] %d\n", s, UTF8LEN(*s)); if ((UTF8LEN(*s) == 2) && UTF8CONT(s[1])) { ucode = ((*s & 0x1f) << 6) | (s[1] & 0x3f); //! HERE I GET UCS CODE printf ("ucode = 0x%x\n", ucode); s++; } s++; } } It's a half of the solution I'm looking for. This code alows me to work with cyrillic symbols only (as they're encoded with 2 bytes in UTF-8). The problem is, I need to work with latin alphabet as well. So what should i do to get UCS code for 1-byte symbol (in my case with UTF8LEN(c)=1)? Upd: Probably, the solution is: ucode = *s Will this work?
Iterating members within lists within a tuple
Imagine having this list [[1,2,3],[1,2,3],[1,2,3]] How to get these permutations: [[1,2,3],[1,2,3],[1,2,3]] [[1,2,3],[1,2,3],[1,3,2]] [[1,2,3],[1,2,3],[2,1,3]] [[1,2,3],[1,2,3],[2,3,1]] .... [[1,2,3],[1,3,2],[1,2,3]] [[1,2,3],[1,3,2],[1,3,2]] [[1,2,3],[1,3,2],[2,1,3]] .... [[3,2,1],[3,2,1],[3,2,1]]
import itertools seq = [[1,2,3], [1,2,3], [1,2,3]] for item in itertools.product(*[itertools.permutations(sublist) for sublist in seq]): print item Result: ((1, 2, 3), (1, 2, 3), (1, 2, 3)) ((1, 2, 3), (1, 2, 3), (1, 3, 2)) ((1, 2, 3), (1, 2, 3), (2, 1, 3)) ((1, 2, 3), (1, 2, 3), (2, 3, 1)) ((1, 2, 3), (1, 2, 3), (3, 1, 2)) ((1, 2, 3), (1, 2, 3), (3, 2, 1)) ((1, 2, 3), (1, 3, 2), (1, 2, 3)) ((1, 2, 3), (1, 3, 2), (1, 3, 2)) ((1, 2, 3), (1, 3, 2), (2, 1, 3)) ((1, 2, 3), (1, 3, 2), (2, 3, 1)) ((1, 2, 3), (1, 3, 2), (3, 1, 2)) ((1, 2, 3), (1, 3, 2), (3, 2, 1)) ((1, 2, 3), (2, 1, 3), (1, 2, 3)) ((1, 2, 3), (2, 1, 3), (1, 3, 2)) ((1, 2, 3), (2, 1, 3), (2, 1, 3)) ((1, 2, 3), (2, 1, 3), (2, 3, 1)) ((1, 2, 3), (2, 1, 3), (3, 1, 2)) ((1, 2, 3), (2, 1, 3), (3, 2, 1)) ((1, 2, 3), (2, 3, 1), (1, 2, 3)) ((1, 2, 3), (2, 3, 1), (1, 3, 2)) ((1, 2, 3), (2, 3, 1), (2, 1, 3)) ((1, 2, 3), (2, 3, 1), (2, 3, 1)) ((1, 2, 3), (2, 3, 1), (3, 1, 2)) ((1, 2, 3), (2, 3, 1), (3, 2, 1)) ((1, 2, 3), (3, 1, 2), (1, 2, 3)) ((1, 2, 3), (3, 1, 2), (1, 3, 2)) ((1, 2, 3), (3, 1, 2), (2, 1, 3)) ((1, 2, 3), (3, 1, 2), (2, 3, 1)) ((1, 2, 3), (3, 1, 2), (3, 1, 2)) ((1, 2, 3), (3, 1, 2), (3, 2, 1)) ((1, 2, 3), (3, 2, 1), (1, 2, 3)) ((1, 2, 3), (3, 2, 1), (1, 3, 2)) ((1, 2, 3), (3, 2, 1), (2, 1, 3)) ((1, 2, 3), (3, 2, 1), (2, 3, 1)) ((1, 2, 3), (3, 2, 1), (3, 1, 2)) ((1, 2, 3), (3, 2, 1), (3, 2, 1)) ((1, 3, 2), (1, 2, 3), (1, 2, 3)) ((1, 3, 2), (1, 2, 3), (1, 3, 2)) ((1, 3, 2), (1, 2, 3), (2, 1, 3)) ((1, 3, 2), (1, 2, 3), (2, 3, 1)) ((1, 3, 2), (1, 2, 3), (3, 1, 2)) ((1, 3, 2), (1, 2, 3), (3, 2, 1)) ((1, 3, 2), (1, 3, 2), (1, 2, 3)) ((1, 3, 2), (1, 3, 2), (1, 3, 2)) ((1, 3, 2), (1, 3, 2), (2, 1, 3)) ((1, 3, 2), (1, 3, 2), (2, 3, 1)) ((1, 3, 2), (1, 3, 2), (3, 1, 2)) ((1, 3, 2), (1, 3, 2), (3, 2, 1)) ((1, 3, 2), (2, 1, 3), (1, 2, 3)) ((1, 3, 2), (2, 1, 3), (1, 3, 2)) ((1, 3, 2), (2, 1, 3), (2, 1, 3)) ((1, 3, 2), (2, 1, 3), (2, 3, 1)) ((1, 3, 2), (2, 1, 3), (3, 1, 2)) ((1, 3, 2), (2, 1, 3), (3, 2, 1)) ((1, 3, 2), (2, 3, 1), (1, 2, 3)) ((1, 3, 2), (2, 3, 1), (1, 3, 2)) ((1, 3, 2), (2, 3, 1), (2, 1, 3)) ((1, 3, 2), (2, 3, 1), (2, 3, 1)) ((1, 3, 2), (2, 3, 1), (3, 1, 2)) ((1, 3, 2), (2, 3, 1), (3, 2, 1)) ((1, 3, 2), (3, 1, 2), (1, 2, 3)) ((1, 3, 2), (3, 1, 2), (1, 3, 2)) ((1, 3, 2), (3, 1, 2), (2, 1, 3)) ((1, 3, 2), (3, 1, 2), (2, 3, 1)) ((1, 3, 2), (3, 1, 2), (3, 1, 2)) ((1, 3, 2), (3, 1, 2), (3, 2, 1)) ((1, 3, 2), (3, 2, 1), (1, 2, 3)) ((1, 3, 2), (3, 2, 1), (1, 3, 2)) ((1, 3, 2), (3, 2, 1), (2, 1, 3)) ((1, 3, 2), (3, 2, 1), (2, 3, 1)) ((1, 3, 2), (3, 2, 1), (3, 1, 2)) ((1, 3, 2), (3, 2, 1), (3, 2, 1)) ((2, 1, 3), (1, 2, 3), (1, 2, 3)) ((2, 1, 3), (1, 2, 3), (1, 3, 2)) ((2, 1, 3), (1, 2, 3), (2, 1, 3)) ((2, 1, 3), (1, 2, 3), (2, 3, 1)) ((2, 1, 3), (1, 2, 3), (3, 1, 2)) ((2, 1, 3), (1, 2, 3), (3, 2, 1)) ((2, 1, 3), (1, 3, 2), (1, 2, 3)) ((2, 1, 3), (1, 3, 2), (1, 3, 2)) ((2, 1, 3), (1, 3, 2), (2, 1, 3)) ((2, 1, 3), (1, 3, 2), (2, 3, 1)) ((2, 1, 3), (1, 3, 2), (3, 1, 2)) ((2, 1, 3), (1, 3, 2), (3, 2, 1)) ((2, 1, 3), (2, 1, 3), (1, 2, 3)) ((2, 1, 3), (2, 1, 3), (1, 3, 2)) ((2, 1, 3), (2, 1, 3), (2, 1, 3)) ((2, 1, 3), (2, 1, 3), (2, 3, 1)) ((2, 1, 3), (2, 1, 3), (3, 1, 2)) ((2, 1, 3), (2, 1, 3), (3, 2, 1)) ((2, 1, 3), (2, 3, 1), (1, 2, 3)) ((2, 1, 3), (2, 3, 1), (1, 3, 2)) ((2, 1, 3), (2, 3, 1), (2, 1, 3)) ((2, 1, 3), (2, 3, 1), (2, 3, 1)) ((2, 1, 3), (2, 3, 1), (3, 1, 2)) ((2, 1, 3), (2, 3, 1), (3, 2, 1)) ((2, 1, 3), (3, 1, 2), (1, 2, 3)) ((2, 1, 3), (3, 1, 2), (1, 3, 2)) ((2, 1, 3), (3, 1, 2), (2, 1, 3)) ((2, 1, 3), (3, 1, 2), (2, 3, 1)) ((2, 1, 3), (3, 1, 2), (3, 1, 2)) ((2, 1, 3), (3, 1, 2), (3, 2, 1)) ((2, 1, 3), (3, 2, 1), (1, 2, 3)) ((2, 1, 3), (3, 2, 1), (1, 3, 2)) ((2, 1, 3), (3, 2, 1), (2, 1, 3)) ((2, 1, 3), (3, 2, 1), (2, 3, 1)) ((2, 1, 3), (3, 2, 1), (3, 1, 2)) ((2, 1, 3), (3, 2, 1), (3, 2, 1)) ((2, 3, 1), (1, 2, 3), (1, 2, 3)) ((2, 3, 1), (1, 2, 3), (1, 3, 2)) ((2, 3, 1), (1, 2, 3), (2, 1, 3)) ((2, 3, 1), (1, 2, 3), (2, 3, 1)) ((2, 3, 1), (1, 2, 3), (3, 1, 2)) ((2, 3, 1), (1, 2, 3), (3, 2, 1)) ((2, 3, 1), (1, 3, 2), (1, 2, 3)) ((2, 3, 1), (1, 3, 2), (1, 3, 2)) ((2, 3, 1), (1, 3, 2), (2, 1, 3)) ((2, 3, 1), (1, 3, 2), (2, 3, 1)) ((2, 3, 1), (1, 3, 2), (3, 1, 2)) ((2, 3, 1), (1, 3, 2), (3, 2, 1)) ((2, 3, 1), (2, 1, 3), (1, 2, 3)) ((2, 3, 1), (2, 1, 3), (1, 3, 2)) ((2, 3, 1), (2, 1, 3), (2, 1, 3)) ((2, 3, 1), (2, 1, 3), (2, 3, 1)) ((2, 3, 1), (2, 1, 3), (3, 1, 2)) ((2, 3, 1), (2, 1, 3), (3, 2, 1)) ((2, 3, 1), (2, 3, 1), (1, 2, 3)) ((2, 3, 1), (2, 3, 1), (1, 3, 2)) ((2, 3, 1), (2, 3, 1), (2, 1, 3)) ((2, 3, 1), (2, 3, 1), (2, 3, 1)) ((2, 3, 1), (2, 3, 1), (3, 1, 2)) ((2, 3, 1), (2, 3, 1), (3, 2, 1)) ((2, 3, 1), (3, 1, 2), (1, 2, 3)) ((2, 3, 1), (3, 1, 2), (1, 3, 2)) ((2, 3, 1), (3, 1, 2), (2, 1, 3)) ((2, 3, 1), (3, 1, 2), (2, 3, 1)) ((2, 3, 1), (3, 1, 2), (3, 1, 2)) ((2, 3, 1), (3, 1, 2), (3, 2, 1)) ((2, 3, 1), (3, 2, 1), (1, 2, 3)) ((2, 3, 1), (3, 2, 1), (1, 3, 2)) ((2, 3, 1), (3, 2, 1), (2, 1, 3)) ((2, 3, 1), (3, 2, 1), (2, 3, 1)) ((2, 3, 1), (3, 2, 1), (3, 1, 2)) ((2, 3, 1), (3, 2, 1), (3, 2, 1)) ((3, 1, 2), (1, 2, 3), (1, 2, 3)) ((3, 1, 2), (1, 2, 3), (1, 3, 2)) ((3, 1, 2), (1, 2, 3), (2, 1, 3)) ((3, 1, 2), (1, 2, 3), (2, 3, 1)) ((3, 1, 2), (1, 2, 3), (3, 1, 2)) ((3, 1, 2), (1, 2, 3), (3, 2, 1)) ((3, 1, 2), (1, 3, 2), (1, 2, 3)) ((3, 1, 2), (1, 3, 2), (1, 3, 2)) ((3, 1, 2), (1, 3, 2), (2, 1, 3)) ((3, 1, 2), (1, 3, 2), (2, 3, 1)) ((3, 1, 2), (1, 3, 2), (3, 1, 2)) ((3, 1, 2), (1, 3, 2), (3, 2, 1)) ((3, 1, 2), (2, 1, 3), (1, 2, 3)) ((3, 1, 2), (2, 1, 3), (1, 3, 2)) ((3, 1, 2), (2, 1, 3), (2, 1, 3)) ((3, 1, 2), (2, 1, 3), (2, 3, 1)) ((3, 1, 2), (2, 1, 3), (3, 1, 2)) ((3, 1, 2), (2, 1, 3), (3, 2, 1)) ((3, 1, 2), (2, 3, 1), (1, 2, 3)) ((3, 1, 2), (2, 3, 1), (1, 3, 2)) ((3, 1, 2), (2, 3, 1), (2, 1, 3)) ((3, 1, 2), (2, 3, 1), (2, 3, 1)) ((3, 1, 2), (2, 3, 1), (3, 1, 2)) ((3, 1, 2), (2, 3, 1), (3, 2, 1)) ((3, 1, 2), (3, 1, 2), (1, 2, 3)) ((3, 1, 2), (3, 1, 2), (1, 3, 2)) ((3, 1, 2), (3, 1, 2), (2, 1, 3)) ((3, 1, 2), (3, 1, 2), (2, 3, 1)) ((3, 1, 2), (3, 1, 2), (3, 1, 2)) ((3, 1, 2), (3, 1, 2), (3, 2, 1)) ((3, 1, 2), (3, 2, 1), (1, 2, 3)) ((3, 1, 2), (3, 2, 1), (1, 3, 2)) ((3, 1, 2), (3, 2, 1), (2, 1, 3)) ((3, 1, 2), (3, 2, 1), (2, 3, 1)) ((3, 1, 2), (3, 2, 1), (3, 1, 2)) ((3, 1, 2), (3, 2, 1), (3, 2, 1)) ((3, 2, 1), (1, 2, 3), (1, 2, 3)) ((3, 2, 1), (1, 2, 3), (1, 3, 2)) ((3, 2, 1), (1, 2, 3), (2, 1, 3)) ((3, 2, 1), (1, 2, 3), (2, 3, 1)) ((3, 2, 1), (1, 2, 3), (3, 1, 2)) ((3, 2, 1), (1, 2, 3), (3, 2, 1)) ((3, 2, 1), (1, 3, 2), (1, 2, 3)) ((3, 2, 1), (1, 3, 2), (1, 3, 2)) ((3, 2, 1), (1, 3, 2), (2, 1, 3)) ((3, 2, 1), (1, 3, 2), (2, 3, 1)) ((3, 2, 1), (1, 3, 2), (3, 1, 2)) ((3, 2, 1), (1, 3, 2), (3, 2, 1)) ((3, 2, 1), (2, 1, 3), (1, 2, 3)) ((3, 2, 1), (2, 1, 3), (1, 3, 2)) ((3, 2, 1), (2, 1, 3), (2, 1, 3)) ((3, 2, 1), (2, 1, 3), (2, 3, 1)) ((3, 2, 1), (2, 1, 3), (3, 1, 2)) ((3, 2, 1), (2, 1, 3), (3, 2, 1)) ((3, 2, 1), (2, 3, 1), (1, 2, 3)) ((3, 2, 1), (2, 3, 1), (1, 3, 2)) ((3, 2, 1), (2, 3, 1), (2, 1, 3)) ((3, 2, 1), (2, 3, 1), (2, 3, 1)) ((3, 2, 1), (2, 3, 1), (3, 1, 2)) ((3, 2, 1), (2, 3, 1), (3, 2, 1)) ((3, 2, 1), (3, 1, 2), (1, 2, 3)) ((3, 2, 1), (3, 1, 2), (1, 3, 2)) ((3, 2, 1), (3, 1, 2), (2, 1, 3)) ((3, 2, 1), (3, 1, 2), (2, 3, 1)) ((3, 2, 1), (3, 1, 2), (3, 1, 2)) ((3, 2, 1), (3, 1, 2), (3, 2, 1)) ((3, 2, 1), (3, 2, 1), (1, 2, 3)) ((3, 2, 1), (3, 2, 1), (1, 3, 2)) ((3, 2, 1), (3, 2, 1), (2, 1, 3)) ((3, 2, 1), (3, 2, 1), (2, 3, 1)) ((3, 2, 1), (3, 2, 1), (3, 1, 2)) ((3, 2, 1), (3, 2, 1), (3, 2, 1))