пишу код с телефона, поэтому нет возможности проверить что не так.
package com.javarush.task.task04.task0417;
/*
Существует ли пара?
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String A = r.readLine();
String B = r.readLine();
String C = r.readLine();
int a = Integer.parseInt(A);
int b = Integer.parseInt(B);
int c = Integer.parseInt(C);
if (a == b)
System.out.println(a + " " + b);
if (b == c)
System.out.println(b + " " + c);
if (a == c)
System.out.println(a + " " + c);
if (a == b && b == c)
System.out.println(a + " " + b + " " + c);
}
}