Over the hill 2
题号:NC226976
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
64bit IO Format: %lld

题目描述

Bob Roberts is part of a crack espionage team working for the CIA (Chocolate Institute of Alabama) and he is working on decrypting the encoded messages of their arch rivals at the NSA (Nougat Society of Arkansas). Fortunately, the NSA's espionage staff is not nearly as crack as Bob's as they are using the Hill encryption scheme (described in the previous problem) which is susceptible to a known-plaintext attack. Bob has intercepted a plaintext/ciphertext pair and has knowledge of the size of the encryption matrix used by his not-so-sweet enemies. Given these Bob knows that there is a way to determine the encryption matrix, but no one on his staff is exactly sure how (hmmm  not quite as crack as they thought). Bob's come to you to solve this problem for them. One complication is that there might not be enough data to uniquely determine the NSA's encryption matrix, and the data they intercepted might have been corrupted leading to no solution to the problem.

输入描述:

Input begins with a line containing a positive integer  indicating the size of the matrix and the vectors to use in the encryption. After this are two lines: the first of these contains the plaintext and the second the ciphertext. Both of these lines will consist only of characters in the set A, , Z,0, , 9 and the space character. The lengths of both strings are identical and are multiples of . Both of these strings may include trailing blanks.

输出描述:

Output one of three possible answers. If the input does not admit any possible encryption matrix output No solution. Otherwise if the input does not uniquely determine the encryption matrix output Too many solutions. Otherwise output the encryption matrix, one row per line with a single space between values on a line.
示例1

输入

复制
3
ATTACK AT DAWN 
FPLSFA4SUK2W9K3

输出

复制
30 1 9
4 23 7
5 9 13
示例2

输入

复制
3
ATTACK
FPLSFA

输出

复制
Too many solutions
示例3

输入

复制
3
ATTACK AT DAWN 
EPLSFA4SUK2W9K3

输出

复制
No solution

备注:

The length of the strings<=2000