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
a, *sch = list(map(int, input().split()))

points = []
x = []
y = []
for i in range(a):
    pup = tuple(map(int, input().split()))
    x.append(pup[0])
    y.append(pup[1])

upper_x = list(filter(lambda s: s >= sch[0], x))
down_x = list(filter(lambda s: s <= sch[0], x))
upper_y = list(filter(lambda s: s >= sch[1], y))
down_y = list(filter(lambda s: s <= sch[1], y))

print(x, y)
print(upper_x, down_x)
print(upper_y, down_y)

if len(upper_x) > len(down_x):
    if len(upper_y) > len(down_y):
        print(min(upper_x), min(upper_y))
    else:
        print(min(upper_x), max(down_y))
else:
    if len(upper_y) > len(down_y):
        print(min(down_x), min(upper_y))
    else:
        print(min(down_x), max(down_y))