#include "triunghiuri.h"
#include <iostream>
#include <utility>
#include <vector>

int main() {
	std::cin.tie(nullptr)->sync_with_stdio(false);

	int n;
	std::cin >> n;
	std::vector<std::pair<long long, long long>> p(n);
	for (int i = 0; i < n; i++) {
		std::cin >> p[i].first >> p[i].second;
	}

	std::vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) {
		std::cin >> a[i] >> b[i];
	}

	std::vector<std::pair<long long, long long>> q = solve(n, p, a, b);
	for (int i = 0; i < n; i++) {
		std::cout << q[i].first << " " << q[i].second << '\n';
	}
	return 0;
}
