import java.util.ArrayList;
import java.util.Random;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class RandomTest {

 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  String sample1[] = {"a","b","0","1","d","c","g","h","i","j","6","7","k","m","3","4","n"};
  String sample2[] = {"p","r","q","s","t","u","v","w","z","y","x","2","5","8","9","e","f"};
  FileWriter wr=null;
  PrintWriter wout=null;
  
  Random r1 = new Random();
  ArrayList al = new ArrayList();
  int page = 0 ;
  for(int i = 0 ; i<10000;)
  {
   if(i%500==0)
   {
    if(wout!=null)
    {
     wout.close();
     wout = null;
    }
    try {
     if(wr!=null)
     {
      wr.close();
      wr = null;
     }
    } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    }
    page++;
    try {
     wr=new FileWriter("rand_"+page+".txt");
    } catch (Exception e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
    }
   }
   wout=new PrintWriter(wr);
   StringBuffer sb1 = new StringBuffer();
   for(int k=0;k<6;k++)
   {
    sb1.append(sample1[r1.nextInt(17)]);
   }
   if(!al.contains(sb1.toString()))
   {
    al.add(sb1.toString());
    i++;
   }
   else
   {
    continue;
   }
   ArrayList b1 = new ArrayList();
   Random r2 = new Random();
   for(int j = 0 ; j<10000;)
   {
    StringBuffer sb = new StringBuffer();
    for(int p = 0 ;p<6;p++)
    {
     sb.append(sample2[r2.nextInt(17)]);
    }
    if(!b1.contains(sb.toString()))
    {
     b1.add(sb.toString());
     j++;
     //System.out.println(sb1.toString()+sb.toString());
     wout.println(sb1.toString()+sb.toString());
     wout.flush();
    }
   }
   b1.clear();
  }
  al.clear();
 }
}