{"raw_statement":[{"iden":"statement","content":"While I was working in the company, the internet broke. I didn't have anything to do without internet, so I decided to write this ACM problem. \n\nWe need to mix between two strings and also we should keep the same order for both strings. \n\nExample: if we have s1 = \"ab\" and s2 = \"cd\", we can generate six strings: \n\nabcd   acbd \n\nacdb cdab \n\ncadb cabd \n\nthank you for your help in ”Count Mix Strings” problem. now I can calculate the complexity and make input and output files. You will be given the two strings and you should print all the distinct strings that could be generated in the alphabetical order.\n\nYour program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 100). \n\nFollowed by the test cases, each test case is on one line. it contains two strings s1 and s2, both strings consist of at least 1 and at most 8 lower case English letters (from ‘a’ to ‘z’).\n\nFor each test case, print all the distinct strings that could be generated in the alphabetical order. \n\nprint a blank line after each test case.\n\n"},{"iden":"input","content":"Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 100). Followed by the test cases, each test case is on one line. it contains two strings s1 and s2, both strings consist of at least 1 and at most 8 lower case English letters (from ‘a’ to ‘z’)."},{"iden":"output","content":"For each test case, print all the distinct strings that could be generated in the alphabetical order. print a blank line after each test case."},{"iden":"examples","content":"Input2a aaab cdOutputaaaabcdacbdacdbcabdcadbcdab"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ R_1 = [x_1, x_1 + w_1] \\times [y_1, y_1 + h_1] $ be the initial rectangle.  \nLet $ R_2 = [x_2, x_2 + w_2] \\times [y_2, y_2 + h_2] $ be the fixed target rectangle.  \nLet $ K \\in \\mathbb{Z}_{\\geq 0} $ be the maximum number of moves.  \n\nA move reflects $ R_1 $ about one of its four edges (left, right, top, bottom), preserving its width and height.\n\n**Constraints**  \n1. $ 1 \\leq T \\leq 10^5 $  \n2. $ 1 \\leq w_1, h_1, w_2, h_2 \\leq 10^9 $  \n3. $ |x_1|, |y_1|, |x_2|, |y_2| \\leq 10^9 $  \n4. $ 0 \\leq K \\leq 10^9 $\n\n**Objective**  \nCompute the maximum possible area of intersection $ A = \\text{Area}(R_1' \\cap R_2) $, where $ R_1' $ is the rectangle obtained after applying at most $ K $ reflections about its own edges.","simple_statement":"You are given two axis-aligned rectangles, R1 and R2. You can flip R1 up to K times, each time over one of its four edges. After flips, find the maximum possible overlap area between R1 and R2.","has_page_source":false}