// Andrew Miller
// Solution to 2006 BHCSI Mock Contest #1 Problem Decipher

import java.util.*;
import java.io.*;

public class decipher
{
	// Performs the appropriate transposition backwards.
	public static String decrypt(String ciphertext, int key)
	{
		// Figure out the required dimensions. In particular,
		// width is the number of characters on the first row.
		// mod represents how many rows have width number of
		// characters. The following rows have one fewer number
		// of characters.
		int width = (ciphertext.length() - 1)/key + 1;
		int mod = ciphertext.length() % key;

		char[][] grid = new char[key][width];

		int cur = 0;

		// Store each character from the string, padding the
		// end with spaces.
		for (int i = 0; i < key; i++)
			for (int j = 0; j < width; j++)
				if (j == width - 1 && i >= mod && mod > 0)
					grid[i][j] = ' ';
				else
					grid[i][j] = ciphertext.charAt(cur++);

		String ret = "";

		// Transposing is just switching the loop order.
		for (int j = 0; j < width; j++)
			for (int i = 0; i < key; i++)
				if (grid[i][j] != ' ')
					ret += grid[i][j];

		return ret;
	}

	public static void main(String[] args) throws IOException
	{

		Scanner sc1 = new Scanner(new File("decipher.in"));
		int n = sc1.nextInt();
		
		// Process each case.
		for (int i=1; i<=n; i++) {

			int key = sc1.nextInt();			
			String ciphertext = sc1.next();
			System.out.println("Plaintest #"+i+": "+decrypt(ciphertext, key));
		}
		
	}
}

