import java.io.*;
public class PSA8B
{
   public static void main(String[] args)throws IOException
   {
       /* Choosing a picture and initializing variables. */
       Picture pic = new Picture(FileChooser.pickAFile());
       int x, y, size;
       pic.show();
       int width = pic.getWidth();
       int height = pic.getHeight();
       int index = 0;
       System.out.println("Picture loaded - width: " + pic.getWidth()+" height: "+ pic.getHeight());


       for (index = 0; index < 3; index++)
       {
         /* Prompting the user for coordinates. */
         String prompt = "Please enter a position (first x, then y) in the ";
         String prompt2 = "picture to flip horizontally.";
         System.out.println(prompt + prompt2);


         /* Converting coordinates to ints. */
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         x = (new Integer(br.readLine())).intValue();
         y = (new Integer(br.readLine())).intValue();


         /* Prompting the user for size. */
         System.out.println("Please enter the size of the box to flip.");
         size = (new Integer(br.readLine())).intValue();


          pic.flipHorizontal(x, y, size);
          /* Repainting the picture with the horizontal flips completed. */
          pic.repaint();
      }


       for (index = 0; index < 3; index++)
       {
         /* Prompting the user for coordinates. */
         String prompt = "Please enter a position (first x, then y) in the ";
         String prompt2 = "picture to flip horizontally.";
         System.out.println(prompt + prompt2);


         /* Converting coordinates to ints. */
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         x = (new Integer(br.readLine())).intValue();
         y = (new Integer(br.readLine())).intValue();


         /* Prompting the user for size. */
         System.out.println("Please enter the size of the box to flip.");
         size = (new Integer(br.readLine())).intValue();


         pic.flipVertical(x, y, size);
         /* Repainting the picture with the horizontal flips completed. */
         pic.repaint();
       }
    }
}