#include <iostream>
using namespace std;

int main()
{
    int l1, r1, l2, r2;
    cin >> l1 >> r1 >> l2 >> r2;
    // make l1 and r1 represent the left range
    // and  l2 and r2 represent the right range
    if (l1 > l2)
    {
        // swap l1 with l2
        int tmpL = l1;
        l1 = l2;
        l2 = tmpL;
        // swap r1 with r2
        int tmpR = r1;
        r1 = r2;
        r2 = tmpR;
    }
    if (l2 > r1)
    {
        // no intersection between the 2 ranges
        cout << -1;
    }
    else
    {
        // check the start and end of the intersection between the 2 ranges
        int rangeL = l2, rangeR;
        // check the end of the range, it can be r1 or r2 (the least between them)
        if (r1 < r2)
        {
            rangeR = r1;
        }
        else
        {
            rangeR = r2;
        }
        cout << rangeL << " " << rangeR;
    }
}
