https://www.acmicpc.net/problem/3009
#include <iostream>
using namespace std;
int main() {
int x1,y1,x2,y2;
cin>>x1>>y1;
int x=0;
int y=0;
int cx=0;
int cy=0;
for(int i=0;i<2;i++){
cin>>x2>>y2;
if(x1==x2) cx++;
else x=x2;
if(y1==y2) cy++;
else y=y2;
}
printf("%d %d",cx==1?x:x1,cy==1?y:y1);
}