//* Problem  : B. Watchdog
//* Contest  : NWERC - 2004
//* Type     : Solution
//* Date     : 2008.08.04
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 6.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

typedef pair <int,int> PIII;
typedef vector <int> VI;
typedef vector <vector<int> > VVI;
typedef vector <pair<int,int> > VPII;
typedef vector <vector<pair<int,int> > > VVPII;

#define int64 long long
#define PI (2.0 * acos(0.0))
#define MP make_pair
#define PB push_back
#define SZ(a) (int)a.size()
#define FOR(i, n) for (int i = 0; i < (int)n; i++)
#define FORSZ(i, a) FOR(i, SZ(a))
#define FORE(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(a); i >= int(b); i--)
#define INF 1000000000
#define INFL 1000000000000000000LL
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()

inline int si(){int tt; scanf("%d", &tt); return tt;}

int S, n, res_y, res_x, x[100], y[100];

int a[100][100];

void solve()
{
	for (res_x = 0; res_x <= S; res_x++)
	for (res_y = 0; res_y <= S; res_y++)
	if (!a[res_x][res_y])
	{
		int f = 1;
		int dmax = 0;
		FOR(i, n)
		{
			int dx = res_x - x[i]; dx *= dx;
			int dy = res_y - y[i]; dy *= dy;
			dmax = max(dmax, dx + dy);
		}
		if (res_x * res_x < dmax) f = 0;
		if (res_y * res_y < dmax) f = 0;
		if ((S-res_x) * (S-res_x) < dmax) f = 0;
		if ((S-res_y) * (S-res_y) < dmax) f = 0;
		if (f) return;
	}
	res_x = -1;
}

void result()
{
	if (res_x >= 0) printf("%d %d\n", res_x, res_y);
	else printf("poodle\n");
}

int main()
{
#ifdef _DEBUG
	freopen("1064", "r", stdin);
	freopen("1064w", "w", stdout);
#endif
	int nt = si();
	while (nt--)
	{
		memset(a, 0, sizeof(a));
		S  = si(); n = si();
		FOR(i, n)
		{
			x[i] = si(); y[i] = si();
			a[x[i]][y[i]] = 1;
		}
		solve();
		result();
	}
	return 0;
}

