fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12.  
  13. Scanner in = new Scanner(System.in);
  14. int n = in.nextInt();
  15. int m = in.nextInt();
  16. int x = in.nextInt();
  17. int y = in.nextInt();
  18. if (x > 1) System.out.print((x-1)+" "+y+"\n");//cout << x - 1 << " " << y << endl;
  19. if (x < n) System.out.print((x+1)+" "+y+"\n");//cout << x + 1 << " " << y << endl;
  20. if (y > 1) System.out.print(x+" "+(y-1)+"\n");//cout << x << " " << y - 1 << endl;
  21. if (y < m) System.out.print(x+" "+(y+1)+"\n");//cout << x << " " << y + 1 << endl;
  22. }
  23. }
  24.  
  25.  
  26.  
  27.  
Success #stdin #stdout 0.06s 2184192KB
stdin
3 3
2 2
stdout
1 2
3 2
2 1
2 3