# Equations in Disguise

There is a one-to-one mapping from letters a, b, c, d, . . . , m to digits (0..9), plus sign (+), multiplication sign () and equality sign (=). Your task is the find the mapping given a set of equations. In each equation, there is exactly one equality sign, both sides of which are in-fix expressions. Numbers are in decimal form without leading zeros, operators are binary operators, and multiplications are always done before additions (there is no parenthesis). Input The input consists of at most 50 test cases. Each case contains a single integer n (0 < n < 21), indicating the numberof equations. Each of the n lines contained a string consisting of at least 5 and at most 11 letters ranging from a to m. The last case is followed by a single zero, which should not be processed. Output For each test case, print the case number and all decidable pairs. A pair is decidable if it is true in every possible solution. The pairs should be sorted in increasing order of the letter. There should be exactly one space between two letter-value pairs, but no space between the letter and its value. If no solution is found, print ‘No’. If nothing is decidable (but there is at least one solution), print ‘Oops’. Note: In the first sample, all possible solutions are {6 ∗2=12, 2=1+1}, {6∗4=24, 4=2+2}, {6∗8=48, 8=4+4},soaismappedto6,bismappedto∗,dismappedto=,fismappedto+. cmaybemapped to 2, 4 or 8, e may be mapped to 1, 2 or 4, thus undecidable. All other letters not appeared in any equation are also undecidable. Sample Input 2 abcdec cdefe 1 milim 1 abcde 1 abmab 0 Sample Output Case 1: a6 b d= f+ Case 2: No Case 3: Oops Case 4: m=