#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#pragma warning(disable:4996)
using namespace std;
class Rectangle
{
public:
int x1, y1;//矩形的左下角坐标
int x2, y2;//矩形的右上角坐标
Rectangle(int X1 = 0, int Y1 = 0, int X2 = 0, int Y2 = 0)
{
x1 = X1, y1 = Y1, x2 = X2, y2 = Y2;
}
bool isInRec(const int &X,const int &Y)
{
if (X > x1&&X<x2&&Y>y1&&Y < y2)
{
return true;
}
return false;
}
};
int main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int T; cin >> T;
while (T--)
{
int W, H, n; cin >> n >> W >> H;
vector<Rectangle>rec; rec.push_back({0,0,W,H});
vector<bool>visited; visited.push_back(false);
while (n--)
{
int x, y; cin >> x >> y;
for (size_t i = 0, size = rec.size();i!=size;i++)
{
//如果该点在矩形内部
if (!visited[i]&&rec[i].isInRec(x, y))
{
auto x1 = rec[i].x1, x2 = rec[i].x2, y1 = rec[i].y1, y2 = rec[i].y2;
visited[i] = true;
rec.push_back({x1,y1,x,y2});//左
visited.push_back(false);
rec.push_back({x,y1,x2,y2});//右
visited.push_back(false);
rec.push_back({ x1,y,x2,y2 });//上
visited.push_back(false);
rec.push_back({x1,y1,x2,y});//下
visited.push_back(false);
}
}
}
int ans = 0; Rectangle square;
for (size_t i = 0; i != rec.size(); i++)
{
if (!visited[i]&&min(rec[i].x2 - rec[i].x1, rec[i].y2 - rec[i].y1) > ans)
{
ans = min(rec[i].x2 - rec[i].x1, rec[i].y2 - rec[i].y1);
square = rec[i];
}
}
cout << square.x1 << ' ' << square.y1 << ' ' << ans << endl;
if (T)
{
cout << endl;
}
}
return 0;
}