1 1000000000 7
1000000000 9
 3 2 2
2 4
2 1
3 6
 2 1000000000 100000
1000000000 1000000
1000000000 10000
 1 100 100
50 70
 1 100 100
101 100

1
1000000000 8 2
2 3 1
1000000000 100001 1
99 100 1
101 100
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
using namespace std::tr1;
#define ll long long
#define MAX 1000000000
#define f(i,a,b) for(long long i=a;i<b;i++)
#define tc int t;cin>>t;while(t--)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define input(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define output(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" ";
#define up upper_bound
#define lo lower_bound
#define mem(a) memset(a,-1,sizeof(a))

// bool comp(pair<ll, ll> &a,pair<ll, ll> &b){
// 	// if(a.first == b.first)
// 		return a.second>b.second;
// 	// return a.first<b.first;
// }

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	
	int n,a,b;
	cin>>n>>a>>b;
	int p[n],q[n];
	f(i,0,n){
		cin>>p[i]>>q[i];
	}

	sort(p,p+n);
	sort(q,q+n);

	int u,d,l,r;
	int x = up(p,p+n,a)-p;
	int y = up(q,q+n,b)-q;
	l = x;
	r = n-x;
	u = y;
	d = n-y;

	int ans = max(l,max(r,max(u,d)));
	cout<<ans<<endl;
	if(ans == l) cout<<p[x-1]<<" "<<b;
	else if(ans == r) cout<<p[x]<<" "<<b;
	else if(ans == u) cout<<q[y-1]<<" "<<a;
	else if(ans == d) cout<<q[y]<<" "<<a;

	return 0;
}