#include <bits/stdc++.h>
using namespace std;
pair<int,int> func(vector<vector<int>>&matrix)
{
vector<int>xaxis;
vector<int>yaxis;
for(int i=0;i<matrix.size();i++)
{
xaxis.push_back(matrix[i][0]);
xaxis.push_back(matrix[i][2]);
yaxis.push_back(matrix[i][1]);
yaxis.push_back(matrix[i][3]);
}
sort(xaxis.begin(),xaxis.end());
sort(yaxis.begin(),yaxis.end());
int size=xaxis.size();
int mid=(ceil((double)size / 2) - 1);
return {xaxis[mid],yaxis[mid]};
}
int main()
{
//TC 1
vector<vector<int>>matrix{{0,0,2,0},{0,2,3,2},{3,1,3,4}};
auto x=func(matrix);
cout<<x.first<<" "<<x.second<<endl;
//TC 2
vector<vector<int>>matrix1{{4,2,4,5},{3,3,5,3},{0,3,0,4}};
auto x1=func(matrix1);
cout<<x1.first<<" "<<x1.second<<endl;
//TC 3
vector<vector<int>>matrix2{{2,4,2,0},{2,1,0,1},{4,3,4,4},{5,5,4,5}};
auto x2=func(matrix2);
cout<<x2.first<<" "<<x2.second<<endl;
return 0;
}