import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int[] a = new int[5];
for(int i=0;i<5;i++){
a[i] = sc.nextInt();
}
int max = a[0];
int min = a[0];
for(int i=0;i<5;i++){
if(max < a[i]){
max = a[i];
}if(min > a[i]){
min = a[i];
}
}
System.out.println(max + " " + min);
}
}
/**************************************************************
Problem: 1639
User: admin
Language: Java
Result: Accepted
Time:529 ms
Memory:41852 kb
****************************************************************/