/*
TASK:dist
LANG:C++
*/

#include <cstdio>
#include <cmath>

using namespace std;

struct point
{
	long x;
	long y;
};

point P0;
long min = 1500000;

long dist (point p)
{
	return (long) sqrt((p.x-P0.x)*(p.x-P0.x)+(p.y-P0.y)*(p.y-P0.y));
}

int main ()
{
	int i, n;
	point P;
	long d;
	
	scanf ("%d %d %d ", &n, &P0.x, &P0.y);
	for (i = 0; i < n; i++)
	{
		scanf ("%d %d\n", &P.x, &P.y);
		d = dist(P);
		if (d < min) min = d;
	}

	printf ("%d\n", min);
	return 0;
}
