#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <vector>

using namespace std;

typedef long double LD;
typedef pair<int, int> II;
const LD EPS = 1e-8;

bool solve(int N, vector<int> a, vector<int> b, vector<int> c, vector<int> d) {
	if (N <= 1) return true;
	LD dx = a[1] - a[0], dy = b[1] - b[0], r = sqrtl(dx * dx + dy * dy), deg = atan2l(dy, dx);
	set<II> s;
	for (int i = 0; i < N; ++i) {
		s.insert(II(a[i] - a[0], b[i] - b[0]));
	}
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			if (i == j) continue;
			LD dx2 = c[j] - c[i], dy2 = d[j] - d[i], r2 = sqrtl(dx2 * dx2 + dy2 * dy2), offset = atan2l(dy2, dx2) - deg;
			if (fabsl(r2 - r) > EPS) continue;
			set<II> s2;
			for (int k = 0; k < N; ++k) {
				LD dx3 = c[k] - c[i], dy3 = d[k] - d[i], r3 = sqrtl(dx3 * dx3 + dy3 * dy3), deg3 = atan2l(dy3, dx3) - offset;
				LD x = roundl(cosl(deg3) * r3), y = roundl(sinl(deg3) * r3);
				LD r4 = sqrtl(x * x + y * y);
				if (fabsl(r4 - r3) <= EPS) {
					s2.insert(II(int(x), int(y)));
				}
			}
			if (s == s2) {
				return true;
			}
		}
	}
	return false;
}

int main() {
#if DEBUG || _DEBUG
	freopen("in.txt", "r", stdin);
	//	freopen("in_1.txt", "r", stdin);
#endif
	int N;
	cin >> N;
	vector<int> a(N), b(N), c(N), d(N);
	for (int i = 0; i < N; i++) {
		std::cin >> a[i] >> b[i];
	}
	for (int i = 0; i < N; i++) {
		std::cin >> c[i] >> d[i];
	}
	cout << (solve(N, a, b, c, d) ? "Yes" : "No") << endl;
	return 0;
}

/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

ll MOD = MODBASE;

ll binPowMod(ll a, ll b) {
    a %= MOD;
    ll res = 1;
    while (b > 0) {
        if (b & 1LL) res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1LL;
    }
    return res;
}

ll add(ll a, ll b) {
    return (a + b) % MOD;
}

ll sub(ll a, ll b) {
    return (a - b + MOD) % MOD;
}

ll mul(ll a, ll b) {
    return a * b % MOD;
}

ll inv(ll u) {
    return binPowMod(u, MOD-2);
}

ll get(ll r) {
    return mul(mul(r, r+1), inv(2));
}

ll getSum(ll l, ll r) {
    if (r < l) return 0;
    return sub(get(r), get(l-1));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int t, n, a, b;
    cin >> t;
    while (t--) {
        cin >> n >> a >> b;
        ll res = mul(mul(n-a+1, n-a+1), mul(n-b+1, n-b+1));

        if (a > b) swap(a, b);
        int l = b, r = b+a-1;
        int g = n-a+1;
        r = min(r, g);
        l = min(l, g);

        // cout << l << ' ' << r << endl;

        ll sum = mul(getSum(l, r-1), 2);
        // cout << getSum(l, r-1) << endl;
        ll remain = n-b+1 - (r - l) * 2;
        sum = add(sum, mul(remain, r));

        sum = mul(sum, sum);
        res = sub(res, sum);
        cout << res << "\n";

    }
    return 0;
}
