/* Problem URL: https://codeforces.com/contest/598/problem/C */ #include #include #include using namespace std; using namespace __gnu_pbds; template > using ordered_set = tree; #define V vector #define rmin(a, b) a = min(a, b) #define rmax(a, b) a = max(a, b) #define rep(i, lim) for (int i = 0; i < (lim); i++) #define nrep(i, s, lim) for (int i = s; i < (lim); i++) #define repv(i, v) for (auto &i : (v)) #define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; } #define sortv(v) sort(v.begin(), v.end()) #define all(v) (v).begin(), (v).end() using vi = vector; using vvi = vector; using vvvi = vector; using vvvvi = vector; using ll = long long; using vl = vector; using vvl = vector; using vvvl = vector; using vvvvl = vector; template auto operator<<(ostream &os, const vector &vec)->ostream& { os << vec[0]; for (size_t i = 1; i < vec.size(); i++) { os << ' ' << vec[i]; } os << '\n'; return os; } template auto operator>>(istream &is, vector &vec)->istream& { for (auto &i : vec) { is >> i; } return is; } template auto operator<<(ostream &os, const vector> &vec)->ostream& { for (auto &i : vec) { os << i[0]; for (size_t j = 1; j < i.size(); j++) { os << ' ' << i[j]; } os << '\n'; } return os; } template auto operator>>(istream &is, vector> &vec)->istream& { for (auto &i : vec) { for (auto &j : i) { is >> j; } } return is; } #define sq(x) ((x)*(ll)(x)) struct pt { // ponto ll x, y; pt(int x_ = 0, int y_ = 0) : x(x_), y(y_) {} bool operator < (const pt p) const { if (x != p.x) return x < p.x; return y < p.y; } bool operator == (const pt p) const { return x == p.x and y == p.y; } pt operator + (const pt p) const { return pt(x+p.x, y+p.y); } pt operator - (const pt p) const { return pt(x-p.x, y-p.y); } pt operator * (const int c) const { return pt(x*c, y*c); } ll operator * (const pt p) const { return x*(ll)p.x + y*(ll)p.y; } ll operator ^ (const pt p) const { return x*(ll)p.y - y*(ll)p.x; } friend istream& operator >> (istream& in, pt& p) { return in >> p.x >> p.y; } }; struct line { // reta pt p, q; line() {} line(pt p_, pt q_) : p(p_), q(q_) {} friend istream& operator >> (istream& in, line& r) { return in >> r.p >> r.q; } }; // PONTO & VETOR ll dist2(pt p, pt q) { // quadrado da distancia return sq(p.x - q.x) + sq(p.y - q.y); } ll sarea2(pt p, pt q, pt r) { // 2 * area com sinal return (q-p)^(r-q); } bool col(pt p, pt q, pt r) { // se p, q e r sao colin. return sarea2(p, q, r) == 0; } bool ccw(pt p, pt q, pt r) { // se p, q, r sao ccw return sarea2(p, q, r) > 0; } int quad(pt p) { // quadrante de um ponto return (p.x<0)^3*(p.y<0); } bool compare_angle(pt p, pt q) { // retorna se ang(p) < ang(q) if (quad(p) != quad(q)) return quad(p) < quad(q); return ccw(q, pt(0, 0), p); } pt rotate90(pt p) { // rotaciona 90 graus return pt(-p.y, p.x); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; V> fds(n); rep(i, n) { cin >> fds[i].first; fds[i].second = i + 1; } sort(all(fds), [&](pair &a, pair &b) { return compare_angle(a.first, b.first); }); auto better = [&](pt &a, pt &b, pt &c, pt &d) { pt p1(a * b, abs(a ^ b)); pt p2(c * d, abs(c ^ d)); return (p1 ^ p2) > 0; }; int ans1 = 0; int ans2 = 1; nrep(i, 1, n - 1) { pt &one = fds[i].first; pt &two = fds[i + 1].first; if (better(one, two, fds[ans1].first, fds[ans2].first)) { ans1 = i; ans2 = i + 1; } } pt &one = fds.back().first; pt &two = fds[0].first; if (better(one, two, fds[ans1].first, fds[ans2].first)) { ans1 = n - 1; ans2 = 0; } cout << fds[ans1].second << ' ' << fds[ans2].second << '\n'; }