// Arup Guha
// 12/15/2016
// Solution to 2016 Online HS Problem: Perfect Number of Windows

import java.util.*;

public class perfect {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Process each case.
		for (int loop=1; loop<=numCases; loop++) {

			int width = stdin.nextInt();
			int side = stdin.nextInt();
			int low = stdin.nextInt();
			int high = stdin.nextInt();

			// Kind of silly...
			ArrayDeque<Integer> sols = new ArrayDeque<Integer>();
			ArrayDeque<Integer> gapList = new ArrayDeque<Integer>();

			// Just loop through each possible gap.
			for (int gap=1; 2*gap+side<=width; gap++) {

				// Not possible.
				if ((width-gap)%(side+gap) != 0) continue;

				// Get # of windows.
				int numW = (width-gap)/(side+gap);

				// Not being smart, letting the brute force go.
				if (numW <low || numW > high) continue;

				// Corresponding side length.
				sols.addFirst(numW);
				gapList.addFirst(gap);
			}

			// Output list.
			System.out.println("Wall #"+loop+": "+sols.size());
			while (sols.size() > 0)
				System.out.println(sols.pollFirst()+" "+gapList.pollFirst());
			System.out.println();
		}
	}
}