Problem: A balanced bracket sequence is defined as an integer sequence that can be built with the following rules:

  * The empty sequence is balanced. 
  * If [a_1,…,a_n] and [b_1,…, b_m] are balanced, then their concatenation [a_1,…,a_n,b_1,…,b_m] is balanced. 
  * If x is a positive integer and [a_1,…,a_n] is balanced, then [x,a_1,…,a_n,-x] is balanced. 



The positive numbers can be imagined as opening brackets and the negative numbers as closing brackets, where matching brackets must have the same type (absolute value). For example, [1, 2, -2, -1] and [1, 3, -3, 2, -2, -1] are balanced, but [1, 2, -1, -2] and [-1, 1] are not balanced.

There are 2n cards. Each card has a number on the front and a number on the back. Each integer 1,-1,2,-2,…,n,-n appears exactly once on the front of some card and exactly once on the back of some (not necessarily the same) card.

You can reorder the cards however you like. You are not allowed to flip cards, so numbers cannot move between the front and back. Your task is to order the cards so that the sequences given by the front numbers and the back numbers are both balanced, or report that it is impossible.

Input

The first line contains a single integer n (1≤ n≤ 2⋅ 10^5) — the number of bracket types, and half the number of cards.

The next 2n lines describe the cards. The i-th of these lines contains two integers a_i, b_i (-n≤ a_i,b_i≤ n, a_i≠ 0, b_i≠ 0) — the numbers on the front and back of the i-th card, respectively. Every integer 1,-1,2,-2,…,n,-n appears exactly once as a_i and exactly once as b_i.

Output

On the first line, output "YES" if it's possible to reorder these cards to satisfy the condition. Otherwise, output "NO". You can print each letter in any case (upper or lower).

If it is possible, on the next 2n lines output the cards in an order so that the front and back are both balanced. If there are multiple solutions, you may output any.

Examples

Input


5
1 3
-3 -5
4 -3
2 2
-1 -4
-2 5
3 -1
5 1
-4 4
-5 -2


Output


YES
1 3
4 -3
-4 4
-1 -4
5 1
3 -1
2 2
-2 5
-3 -5
-5 -2


Input


2
1 1
-1 2
2 -1
-2 -2


Output


NO

Note

In the first test case, the front numbers create the balanced sequence [1,4,-4,-1,5,3,2,-2,-3,-5] and the back numbers create the balanced sequence [3,-3,4,-4,1,-1,2,5,-5,-2].

In the second test case, the cards are given in an order so that the front numbers are balanced, but the back numbers create the unbalanced sequence [1,2,-1,-2]. If we swapped the second and third cards, we would balance the back numbers and unbalance the front numbers. But there is no order that balances both.

Solution (in CPP):

Solution:
/**
 *  created: 05/04/2021, 19:59:41
**/

#include <bits/stdc++.h>

using namespace std;

const int max_n = 2 * 200222, inf = 1000111222;

const int seed = chrono::steady_clock::now().time_since_epoch().count();
mt19937 generator(0);

int rnd() {
    return generator() >> 1;
}

int rnd(int r) {
    return rnd() % r;
}

int rnd(int l, int r) {
    return l + rnd(r - l + 1);
}

struct DoublyLinkedList {
    list<int> a, b;
    list<int>::iterator mxa, mxb;

    DoublyLinkedList() {
    }

    DoublyLinkedList(int x): a{x}, b{x} {
        mxa = --a.end();
        mxb = b.begin();
    }

    DoublyLinkedList(const initializer_list<int> &v): a(v), b(v) {
        b.reverse();

        mxa = --a.end();
        mxb = b.begin();
    }

    void combine(DoublyLinkedList &l, bool f) {
        a.splice(a.end(), l.a);
        l.b.splice(l.b.end(), b);
        b.swap(l.b);

        if (f) {
            mxa = l.mxa;
            mxb = l.mxb;
        }
    }

    void reverse() {
        a.swap(b);
        swap(mxa, mxb);
    }
};

int n, a[max_n], b[max_n], pos_a[max_n], pos_b[max_n];
int used[max_n];
DoublyLinkedList dl[max_n];

void write(int l, int r) {
    cout << l << " " << r << ": ";
    for (int i : dl[l].a) {
        cout << i << " ";
    }
    cout << endl;
}

void solve_rec(vector<int> &tps, int l, int r) {
    if (l > r) {
        return;
    }
    if (l + 1 == r) {
        assert(tps[l] != tps[r]);
        dl[l] = {l, l + 1, l + 2};
        if (tps[l]) {
            dl[l].reverse();
        }
        //write(l, r);
        return;
    }
    if (tps[l] != tps[r]) {
        solve_rec(tps, l + 1, r - 1);
        dl[r] = {r + 1};
        bool f = 1;
        if (tps[l]) {
            //cout << "### " << all_pos[l] << " " << all_pos[r] << endl;
            swap(dl[l], dl[r]);
            f = 0;
        }
        dl[l + 1].reverse();
        dl[l].combine(dl[l + 1], 0);
        dl[l].combine(dl[r], f);
    } else {
        int bal1 = 0, bal2 = 0, len = 0;
        do {
            if (tps[l + len]) {
                ++bal1;
            } else {
                --bal1;
            }
            if (tps[r - len]) {
                ++bal2;
            } else {
                --bal2;
            }
            ++len;
        } while (bal1 && bal2);
        if (!bal2) {
            len = r - l + 1 - len;
        }
        solve_rec(tps, l, l + len - 1);
        solve_rec(tps, l + len, r);

        //cout << (*dl[l].mxa) << " " << (*dl[l].mxb) << " " << (*dl[l + len].mxa) << " " << (*dl[l + len].mxb) << endl;
        dl[l].a.splice(next(dl[l].mxa), dl[l + len].a);
        dl[l].a.erase(dl[l].mxa);
        dl[l].mxa = dl[l + len].mxa;

        dl[l].b.splice(next(dl[l].mxb), dl[l + len].b);
        dl[l].b.erase(dl[l].mxb);
        dl[l].mxb = dl[l + len].mxb;
        //dl[l].combine(dl[l + len]);
    }
    //write(l, r);
}

vector<int> solve(vector<int> &all_pos, vector<int> &tps) {
    assert(tps.size() == all_pos.size() && tps.size() >= 2);
    assert(a[all_pos[0]] > 0 && tps[0] == 1 && tps.back() == 1);
    for (int i = 0; i < tps.size(); ++i) {
        dl[i] = {i};
        //cout << i << ": " << all_pos[i] << " " << tps[i] << endl;
    }
    solve_rec(tps, 1, tps.size() - 2);
    dl[0].combine(dl[1], 1);
    //write(0, tps.size() - 1);
    vector<int> res;
    //dl[0].a = {0, 1, 2, 7, 6, 5, 4, 3};
    for (int i : dl[0].a) {
        res.push_back(all_pos[i]);
        //cout << res.back() << " # ";
    }
    //cout << endl;
    return res;
}

void check(vector<int> &v) {
    for (int i = 0; i < 2; ++i) {
        vector<int> st;
        for (int pos : v) {
            int x = a[pos];
            if (i == 1) {
                x = b[pos];
            }
            if (x < 0) {
                if (st.empty() || st.back() != -x) {
                    v = {};
                    break;
                }
                //assert(!st.empty() && st.back() == -x);
                st.pop_back();
            } else {
                st.push_back(x);
            }
        }
    }
}

vector<int> solve() {
    for (int i = 0; i < 2 * n; ++i) {
        pos_a[a[i] + n] = i;
        pos_b[b[i] + n] = i;
        used[i] = 0;
    }
    vector<int> res;
    for (int i = 0; i < 2 * n; ++i) {
        if (!used[i] && a[i] > 0 && b[i] > 0) {
            int tp = 0, pos = i;
            vector<int> all_pos, tps;
            while (!used[pos]) {
                all_pos.push_back(pos);
                used[pos] = 1;
                if (tp == 0) {
                    tps.push_back(a[pos] > 0);
                    pos = pos_a[-a[pos] + n];
                } else {
                    tps.push_back(b[pos] < 0);
                    pos = pos_b[-b[pos] + n];
                }
                tp ^= 1;
            }
            assert(tps.size() % 2 == 0);
            //cout << i << ": " << tps.size() << "   " << tps.size() / 2 + 1 << " " << accumulate(tps.begin(), tps.end(), 0) << endl;
            if (tps.size() / 2 - 1 == accumulate(tps.begin(), tps.end(), 0)) {
                rotate(all_pos.begin(), all_pos.begin() + 1, all_pos.end());
                reverse(all_pos.begin() + 1, all_pos.end());
                reverse(tps.begin() + 1, tps.end());
                for (int &x : tps) {
                    x ^= 1;
                }
            }
            if (tps.size() / 2 + 1 != accumulate(tps.begin(), tps.end(), 0)) {
                return {};
            }
            bool ok = 0;
            for (int i = 0; i < tps.size(); ++i) {
                if (tps[i] == 1 && tps[(i + tps.size() - 1) % tps.size()] == 1 && a[all_pos[i]] > 0) {
                    ok = 1;
                    rotate(tps.begin(), tps.begin() + i, tps.end());
                    rotate(all_pos.begin(), all_pos.begin() + i, all_pos.end());
                    break;
                }
            }
            assert(ok);
            vector<int> v = solve(all_pos, tps);
            res.insert(res.end(), v.begin(), v.end());
        }
    }
    if (res.size() != 2 * n) {
        return {};
    }
    check(res);
    return res;
}

string gen_rnd_seq(int n) {
    if (n == 0) {
        return "";
    }
    int len = rnd(n);
    return "(" + gen_rnd_seq(len) + ")" + gen_rnd_seq(n - 1 - len);
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    if (0) {
        while (true) {
            n = rnd(1, 200000);
            for (int it = 0; it < 2; ++it) {
                string s = gen_rnd_seq(n);
                int x = 0;
                vector<int> v;
                for (int i = 0; i < 2 * n; ++i) {
                    int val;
                    if (s[i] == '(') {
                        ++x;
                        v.push_back(x);
                        val = x;
                    } else {
                        val = -v.back();
                        v.pop_back();
                    }
                    if (it == 0) {
                        a[i] = val;
                    } else {
                        b[i] = val;
                    }
                }
            }
            if (1) {
                vector<pair<int, int>> p;
                for (int i = 0; i < 2 * n; ++i) {
                    p.push_back({a[i], b[i]});
                }
                shuffle(p.begin(), p.end(), generator);
                for (int i = 0; i < 2 * n; ++i) {
                    a[i] = p[i].first;
                    b[i] = p[i].second;
                }
            }
            vector<int> ans;
            if (n) {
                ans = solve();
            }
            if (ans.empty()) {
                cout << n << endl;
                for (int i = 0; i < 2 * n; ++i) {
                    cout << a[i] << " " << b[i] << endl;
                }
            }
            assert(!ans.empty());
            cout << "+";
        }
    }
    scanf("%d", &n);
    for (int i = 0; i < 2 * n; ++i) {
        scanf("%d%d", &a[i], &b[i]);
    }
    vector<int> ans = solve();
    if (ans.empty()) {
        puts("NO");
    } else {
        puts("YES");
        for (int i : ans) {
            printf("%d %d\n", a[i], b[i]);
        }
    }
    return 0;
}