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.
#include <bits/stdc++.h>
using i64 = int64_t;
using u64 = uint64_t;
using u32 = uint32_t;
void gg() {
    std::cout << "NO\n";
    std::exit(0);
}
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n;
    std::cin >> n;
    std::vector<int> a(2 * n), b(2 * n);
    std::vector<int> xa(n), ya(n), xb(n), yb(n);
    for (int i = 0; i < 2 * n; i++) {
        std::cin >> a[i] >> b[i];
        if (a[i] > 0) {
            xa[a[i] - 1] = i;
        } else {
            ya[-1 - a[i]] = i;
        }
        if (b[i] > 0) {
            xb[b[i] - 1] = i;
        } else {
            yb[-1 - b[i]] = i;
        }
    }
    std::vector<bool> vis(2 * n);
    std::vector<int> ans;
    std::vector<int> next(2 * n, -1);
    for (int i = 0; i < 2 * n; i++) {
        if (vis[i] || a[i] < 0 || b[i] < 0) {
            continue;
        }
        std::vector<int> u, d;
        int j = i;
        while (!vis[j]) {
            vis[j] = true;
            u.push_back(j);
            if (u.size() % 2 == 1) {
                d.push_back(a[j] > 0);
                j = a[j] > 0 ? ya[a[j] - 1] : xa[-1 - a[j]];
            } else {
                d.push_back(b[j] > 0);
                j = b[j] > 0 ? yb[b[j] - 1] : xb[-1 - b[j]];
            }
        }
        int c[2][2] {};
        for (int j = 0; j < int(d.size()); j++) {
            c[d[j]][j % 2]++;
        }
        if (std::abs(c[0][0] - c[0][1]) != 1 || std::abs(c[1][0] - c[1][1]) != 1) {
            gg();
        }
        std::vector<int> s, t, q;
        for (int j = 0; j < int(u.size()); j++) {
            if (s.size() >= 2 && q.back() == q[q.size() - 2]) {
                int x = s.back();
                int y = t.back();
                s.pop_back();
                t.pop_back();
                q.pop_back();
                if (q.back() == 1) {
                    next[t.back()] = x;
                    next[y] = u[j];
                    t.back() = u[j];
                } else {
                    next[u[j]] = x;
                    next[y] = s.back();
                    s.back() = u[j];
                }
                q.back() = d[j];
            } else {
                s.push_back(u[j]);
                t.push_back(u[j]);
                q.push_back(d[j]);
            }
        }
        if (s.size() == 4) {
            next[t[0]] = s[3];
            next[t[3]] = s[2];
        }
        for (int j = s[q[1]]; j != -1; j = next[j]) {
            ans.push_back(j);
        }
        for (int j = s[q[0]]; j != -1; j = next[j]) {
            ans.push_back(j);
        }
    }
    if (int(ans.size()) < 2 * n) {
        gg();
    }
    std::cout << "YES\n";
    for (int i = 0; i < 2 * n; i++) {
        std::cout << a[ans[i]] << " " << b[ans[i]] << "\n";
    }
    return 0;
}
