/**
 * @(#)shopkeep.java
 *
 *
 * @author : Dan Deblasio
 * @version 1.00 2008/7/10
 */

import java.util.*;
import java.io.*;

public class shopkeep {
        
    public static void main(String[] args) throws FileNotFoundException {
        
        Scanner fin = new Scanner(new File("shopkeep.in"));
        
        int n = fin.nextInt();
        
        // Read through each case.
        for(int i=0;i<n;i++){
        	
        	// Get the input values for the case.
        	int x = fin.nextInt();
        	int y = fin.nextInt();
        	int d = fin.nextInt();
        	
        	// Output the heading required.
        	System.out.println("["+x+" "+y+"] ## "+d);
        	
        	// c1 counts the total number of choices (it's also y - x + 1...)
        	// c2 counts the number of choices that we can actually get.
        	int c1 =0, c2 =0;
        	for(int j=x;j<=y;j++){
        		c1++;
        		
        		// We can only get j pieces if d divides evenly into j.
        		if(j%d==0){
        			
        			// The problem asks us to print this value out.
        			System.out.println(j);
        			c2++;
        		}
        	}
        	
        	// Final output.
        	System.out.println("There were "+c2+" of "+c1+" different choices that are valid.");
        	
        	// For formatting we need two blank lines.
        	System.out.println();System.out.println();
        }
        
        fin.close();
    }
}
