// Arup Guha
// 2/7/2015
// Solution to 2015 UCF Online High School Contest Problem: Electronic Toilet Dilemma

import java.util.*;

public class toilet {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Process all cases.
		for (int loop=1; loop<=numCases; loop++) {

			// Read case.
			int onLimit = stdin.nextInt();
			int offLimit = stdin.nextInt();
			String data = stdin.next();

			// Case header.
			System.out.print("Toilet #"+loop+" flush times:");

			// Get on streaks.
			StringTokenizer tok = new StringTokenizer(data, "-");
			ArrayList<Integer> onStreaks = new ArrayList<Integer>();
			while (tok.hasMoreTokens())
				onStreaks.add(tok.nextToken().length());

			// Get off streaks.
			tok = new StringTokenizer(data, "#");
			ArrayList<Integer> offStreaks = new ArrayList<Integer>();
			while (tok.hasMoreTokens())
				offStreaks.add(tok.nextToken().length());

			// Get starting streak.
			int offIndex = 0, onIndex = 0;
			boolean nextOn = true;
			if (data.charAt(0) == '-') nextOn = false;

			ArrayList<streak> list = new ArrayList<streak>();

			// Build merged list.
			while (offIndex < offStreaks.size() || onIndex < onStreaks.size()) {
				if (nextOn) list.add(new streak(onStreaks.get(onIndex++), true));
				else		list.add(new streak(offStreaks.get(offIndex++), false));
				nextOn = !nextOn;
			}

			// Init settings.
			int curTime = 0, i = 0;
			boolean flushed = false;

			// Go to end of list.
			while (i < list.size()) {

				// Find on segment.
				while (i < list.size() && (!list.get(i).on || list.get(i).length < onLimit)) {
					curTime += list.get(i).length;
					i++;
				}

				// Find off segment.
				while (i < list.size() && (list.get(i).on || list.get(i).length < offLimit)) {
					curTime += list.get(i).length;
					i++;
				}

				// Need to flush.
				if (i < list.size()) {

					System.out.print(" "+(curTime+offLimit));
					curTime += list.get(i).length;
					flushed = true;
					i++;
				}
			}

			// Finish prints.
			if (!flushed) System.out.print(" None");
			System.out.println();
		}
	}
}

class streak {

	public int length;
	public boolean on;

	public streak(int len, boolean isOn) {
		length = len;
		on = isOn;
	}
}