import java.io.*;


class ReadWrite2 {

  
    public static void main(String args[]) throws IOException {

       String Names[] = new String[3];
       int Ages[] = new int[3];
       String line = new String();
       int i;
      
       

       //openup file in FileReader
       FileReader file_input = new FileReader("data.txt");

       //create BufferedReader from FileReader
       BufferedReader BR = new BufferedReader(file_input);

       //open output file
       FileWriter file_output = new FileWriter("reverse.txt");
       BufferedWriter BW = new BufferedWriter(file_output);

       //Read the 6 input lines of alternating Names and Age info
       for(i=0; i<3; i++)
       { 
         
         Names[i] = BR.readLine();
         line = BR.readLine();
         Ages[i] = (Integer.valueOf(line)).intValue( );
         //print info to screen and reverse order to output file
         System.out.println("Data" + i + " " + Names[i] + " " + Ages[i]);
         BW.write(line,0, line.length());
         BW.write("  ", 0, 1);
         BW.write(Names[i],0, (Names[i]).length());
         BW.newLine();
       
        }

        

  
      //Close streams
       BR.close();
       file_input.close();
       BW.close();
       file_output.close();             
   }      
}