In many cultures certain numbers carry particular meanings. For example, 666 is often linked with the Devil, and 777 with good luck. Numbers like these tend to form a visual pattern, so a numerologist hunting for the next meaningful number cares about spotting such patterns.
A number only reveals an interesting pattern in the right base. For instance, 666 in hexadecimal is 29a, far less striking than its base-10 form. To account for every base that past (or even alien!) cultures might have used, you want to test whether a number matches a pattern of interest when written in some base.
We write a number converted to base $b$ as a sequence of symbols $S = \langle s_1, s_2, \dots, s_L \rangle$, where each symbol is an integer (its digit value in that base), listed most significant digit first. For example, the decimal number 10 written in base 2 is $1010$, giving $S = \langle 1, 0, 1, 0 \rangle$ and $L = 4$.
A pattern is a string, for example ab. A sequence $S$ matches a pattern $p$ if and only if both of the following hold:
Under this definition, 10 in base 2 matches the pattern ab (map a$\to$1 and b$\to$0, so abab becomes $\langle 1, 0, 1, 0 \rangle$).
The first line contains the number of data sets $K$. Each of the following $K$ lines contains a positive integer $n$ and a string $p$: the number you care about and the pattern to match against. $n$ fits in a 64-bit integer, $p$ has at most 10 characters, and every character of $p$ is a lowercase letter from a to j.
For each data set output Data Set x: on its own line, where $x$ is the data set's number starting from 1. Then output the smallest base $b$ with $2 \le b \le 1000000$ such that $n$ written in base $b$ matches the pattern $p$. On the next line output the integer symbols of that matching sequence, separated by single spaces with no trailing space. If no base in the range produces a match, output No such base. instead of the base and the sequence. Separate consecutive data sets with a blank line.