#include <iostream>
using namespace std;

int main() {

    int arr[6] = { 0 };
    int len = sizeof(arr) / sizeof(int);
    
    for (int i = 0; i < len; i++) {
        cin >> arr[i];
    }

    // write your code here......
    cout << min(min(min(arr[0], arr[1]),min(arr[2], arr[3])), min(arr[4], arr[5])) << " " << max(max(max(arr[0], arr[1]),max(arr[2], arr[3])), max(arr[4], arr[5])) << endl;

    return 0;
}