#include using namespace std; typedef long long ll; typedef pair pii; #define pb push_back #define all(a) a.begin(), a.end() #define sz(a) ((int)a.size()) #ifdef Doludu template ostream& operator << (ostream &o, vector vec) { o << "{"; int f = 0; for (T i : vec) o << (f++ ? " " : "") << i; return o << "}"; } void bug__(int c, auto ...a) { cerr << "\e[1;" << c << "m"; (..., (cerr << a << " ")); cerr << "\e[0m" << endl; } #define bug_(c, x...) bug__(c, __LINE__, "[" + string(#x) + "]", x) #define bug(x...) bug_(32, x) #define bugv(x...) bug_(36, vector(x)) #define safe bug_(33, "safe") #else #define bug(x...) void(0) #define bugv(x...) void(0) #define safe void(0) #endif const int mod = 998244353, N = 1 << 20; int sign(ll x) { return clamp(x, -1ll, 1ll); } template struct P { T x, y; int id; P (T _x, T _y, int _id = -1) : x(_x), y(_y), id(_id) {} P operator + (P o) { return P(x + o.x, y + o.y);} P operator - (P o) { return P(x - o.x, y - o.y);} P operator * (T k) {return P(x * k, y * k);} P operator / (T k) {return P(x / k, y / k);} T operator * (P o) {return x * o.x + y * o.y;} T operator ^ (P o) {return x * o.y - y * o.x;} friend ostream& operator << (ostream &o, P a) { return o << "(" << a.x << ", " << a.y << ")"; } bool operator == (P o) { return sign(x - o.x) == 0 && sign(y - o.y) == 0;} }; using Pt = P; struct Line { Pt a, b; }; struct Cir { Pt o; double r; }; ll abs2(Pt a) { return a * a; } double abs(Pt a) { return sqrt(abs2(a)); } int ori(Pt o, Pt a, Pt b) { return sign((o - a) ^ (o - b)); } bool btw(Pt a, Pt b, Pt c) // c on segment ab? { return ori(a, b, c) == 0 && sign((c - a) * (c - b)) <= 0; } int pos(Pt a) { return sign(a.y) == 0 ? sign(a.x) < 0 : a.y < 0; } bool cmp(Pt a, Pt b) { return pos(a) == pos(b) ? sign(a ^ b) > 0 : pos(a) < pos(b); } bool same_vec(Pt a, Pt b, int d) // d = 1: check dir { return sign(a ^ b) == 0 && sign(a * b) > d * 2 - 2; } bool same_vec(Line a, Line b, int d) { return same_vec(a.b - a.a, b.b - b.a, d); } Pt perp(Pt a) { return Pt(-a.y, a.x); } // CCW 90 deg Pt ref(Pt a) {return pos(a) == 1 ? Pt(-a.x, -a.y) : a;} auto convex_hull(vector pts) { sort(all(pts), [&](Pt a, Pt b) {return a.x == b.x ? a.y < b.y : a.x < b.x;}); vector ans = {pts[0]}; for (int t = 0; t < 2; ++t, reverse(all(pts))) { for (int i = 1, m = sz(ans); i < sz(pts); ++i) { while (sz(ans) > m && ori(ans[sz(ans) - 2], ans.back(), pts[i]) <= 0) ans.pop_back(); ans.pb(pts[i]); } } if (sz(ans) > 1) ans.pop_back(); return ans; } void solve() { int n; cin >> n; vector pts; for (int i = 0, x, y; i < n; ++i) { cin >> x >> y; pts.emplace_back(x, y, i); } auto res = convex_hull(pts); int m = sz(res); vector ans(n, Pt(-1ll << 60, -1ll << 60)); if (m == 2) { if (res[0].x == res[1].x) { ans[res[0].id] = Pt(0, -1); ans[res[1].id] = Pt(0, 1); } else { ans[res[0].id] = Pt(-1, 0); ans[res[1].id] = Pt(1, 0); } } else { assert(m > 2); for (int i = 0; i < m; ++i) { Pt tmp = res[(i + m - 1) % m] - res[(i + 1) % m]; tmp = perp(tmp); ans[res[i].id] = tmp; } } for (int i = 0; i < n; ++i) { if (ans[i].x == -1ll << 60) cout << "No\n"; else cout << ans[i].x << " " << ans[i].y << "\n"; } } int main() { ios::sync_with_stdio(false), cin.tie(0); int t; cin >> t; while (t--) { solve(); } }