Advertisement
vafin20

1

Apr 12th, 2021
951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4.  
  5.  
  6. public class Main {
  7.     public static void main(String[] args) throws IOException {
  8.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  9.         String [] domino1 = reader.readLine().split(" ");
  10.         String [] domino2 = reader.readLine().split(" ");
  11.         int a = Integer.parseInt(domino1[0]);
  12.         int b = Integer.parseInt(domino1[1]);
  13.         int x = Integer.parseInt(domino2[0]);
  14.         int y = Integer.parseInt(domino2[1]);
  15.  
  16.         if (a == x) {
  17.             System.out.println(b + " " + a + " " + x + " "  + y);
  18.         }
  19.         else if (a == y) {
  20.             System.out.println(b + " " + a + " " + y + " "  + x);
  21.         }
  22.         else if (b == x) {
  23.             System.out.println(a + " " + b + " " + x + " "  + y);
  24.         }
  25.         else if (b == y) {
  26.             System.out.println(a + " " + b + " " + y + " "  + x);
  27.         }
  28.         else {
  29.             System.out.println(-1);
  30.         }
  31.     }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement