import java.io.*;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new BufferedReader(new InputStreamReader(System.in)));
BufferedWriter bw = new BufferedWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
BigInteger total = new BigInteger(br.readLine());
BigInteger gap = new BigInteger(br.readLine());
BigInteger firstPerson = total.add(gap).divide(BigInteger.valueOf(2));
BigInteger secondPerson = total.subtract(gap).divide(BigInteger.valueOf(2));
bw.write(String.valueOf(firstPerson));
bw.newLine();
bw.write(String.valueOf(secondPerson));
bw.flush();
bw.close();
}
}