//神奇的nim游戏....
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int a[110];
int ge[110], ne[110];//ge为0-1,2-3 ne为1-2,3-4.....
int main() {
int n = 0; //数字下标
while(~scanf("%d",&a[n])) n++;
int gn = 0;
int sum = 0;
for(int i = 1; i < n; i=i+2){
ge[gn] = a[i]-a[i-1]-1;
if(i+1 < n)
ne[gn] = a[i+1] - a[i]-1;
sum ^= ge[gn];
gn++;
}
if(sum == 0) printf("-1");
else{
int ok = 0;
for(int i = 0; i < n; i+=2){
/*
for(int j = 1; j < a[i+1]-a[i]; j++){
//因为之前pm是按i+=2上来的 所以 若i为偶数,i/2为ge[]的左端点,否则,为ge[]右端点
if(i%2 == 0){
if((sum^ge[i/2]^(ge[i/2]-j)) == 0){//左端点 往上走,距离减小
printf("%d %d",a[i],a[i]+j);
ok = 1;
}
}else{
if((sum^ge[i/2]^(ge[i/2]+j)) == 0){//右端点往上走,距离增加 //1^1 = 0即^原来的值,取消原来制的影响,引入新值
printf("%d %d",a[i],a[i]+j);
ok = 1;
}
}
*/
int x = sum^ge[i/2], l = ge[i/2], r = ne[i/2]+ge[i/2];
//cout << x << " l" << l << " r" << r << endl;
if(x <= l){//左端点 往上走,距离减小
printf("%d %d", a[i], a[i]+l-x);
ok = 1;
}
else if(x <= r){//右端点往上走,距离增加 //1^1 = 0即^原来的值,取消原来制的影响,引入新值
printf("%d %d", a[i+1], a[i+1]-l+x);
ok = 1;
}
if(ok) break;
}
}
return 0;
}