1.

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem: Kaprekar Numbers (974)
* @author Christian Mitterreiter
* @author Rolf Luigs
* @version 1.0, 04/01/2009
* Status : Accepted
* Runtime: 0.740
*/


import java.io.*;
import java.util.*;
public class Main {

public static void main (String... arg)
{
Scanner scanner=null;
scanner = new Scanner(System.in);
int lang=scanner.nextInt();
int[] input = new int [lang*2+1];
input[0]=lang;
int k=0;

while (k<input[0]*2)
{ k++;
input[k]=scanner.nextInt();
}

for (int i=1, m=1;i<input[0]*2;i+=2,m++)
{
boolean test=true;
System.out.println("case #"+m);
for(int l=input[i];l<=input[i+1];l++)
{
if (test2(l))
{
System.out.println(l);
test=false;
}
}
if (test)
System.out.println("no kaprekar numbers");
if (i<input[0]*2-1)
System.out.print("\n");
}

}

public static boolean test2 (int in)
{
if (in==9)
return true;
if (in==45)
return true;
if (in==55)
return true;
if (in==99)
return true;
if (in==297)
return true;
if (in==703)
return true;
if (in==999)
return true;
if (in==2223)
return true;
if (in==2728)
return true;
if (in==4879)
return true;
if (in==4950)
return true;
if (in==5050)
return true;
if (in==5292)
return true;
if (in==7272)
return true;
if (in==7777)
return true;
if (in==9999)
return true;
if (in==17344)
return true;
if (in==22222)
return true;
if (in==38962)
return true;

return false;
}

}