import java.io.*;


class ReadWrite3 {

  
    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
       FileOutputStream file_output = new FileOutputStream("reverse.txt");
       PrintStream PS = new PrintStream(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]);
         PS.println(line + " " +  Names[i] );
        }

        

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