SP4588 NWERC04H - SETI
Description
For some years, quite a lot of work has been put into listening to electromagnetic radio signals received from space, in order to understand what civilizations in distant galaxies might be trying to tell us. One signal source that has been of particular interest to the scientists at Universit´e de Technologie Spatiale is the Nebula Stupidicus.
Recently, it was discovered that if each message is assumed to be transmitted as a sequence of integers a0, a1, ...an-1 the function f(k) =  (mod p) always evaluates to values 0
Input Format
On the first line of the input there is a single positive integer N, telling the number of test cases to follow. Each case consists of one line containing the value of p to use during the transcription of the string, followed by the actual string to be transcribed. The only allowed characters in the string are the lower case letters ’a’..’z’ and ’\*’ (asterisk). No string will be longer than 70 characters.
Output Format
For each transcribed string, output a line with the corresponding list of integers, separated by space, with each integer given in the order of ascending values of i.