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:
#include <bits/stdc++.h>
const int N = 4e5 + 10;
typedef long long LL;
int ri() {
    int x = 0, f = 1;
    char ch = getchar();
    for(;ch < '0' || ch > '9'; ch = getchar())
        if(ch == '-')
            f = -1;
    for(;ch >= '0' && ch <= '9'; ch = getchar())
        x = (x << 1) + (x << 3) + ch - '0';
    return x * f;
}
int n, uto[N], ufr[N], dto[N], dfr[N], mat[2][N], st[N], way[N], V[N], Ans[N], A[N], B[N], cAns;
bool vis[N], flag = true;
void Mat(int u, int v, int ty) {
    mat[ty][u] = v;
    mat[ty][v] = u;
}
struct Node {
    int v;
    Node *next, *pre;
    Node() {pre = next = NULL; v = 0;}
    Node(int x) {v = x; pre = next = NULL;}
};
struct Cut {
    Node *a, *b;
};
void Connect(Node *a, Node *b) {
    if(a == NULL || b == NULL) return ;
    a->next = b; b->pre = a;
}
struct List {
    Node *head, *tail;
    List() {head = tail = NULL;}
    List(int x) {
        tail = head = new Node(x);
    }
    List &operator += (List &o) {
        Connect(tail, o.head);
        if(o.tail != NULL)
            tail = o.tail;
        return *this;
    }
};
struct Curve {
    List *a, *b;
    Curve() {a = b = NULL;}
    Curve(int x) {
        a = new List(x);
        b = new List(x);
    }
    Curve &operator += (Curve &o) {
        *a += *o.a;
        if(o.b != NULL) {
            *o.b += *b;
            b = o.b;
        }
        return *this;
    }
    void rev() {List *c = b; b = a; a = c;}
};

void Splice(List *s, Node *cut_s, List *t) {
    assert(s != NULL); assert(t != NULL);
    Node *pre_s = cut_s->pre, *next_s = cut_s->next;
    Connect(pre_s, t->head); Connect(t->tail, next_s);
    if(pre_s == NULL) s->head = t->head;
    if(next_s == NULL) s->tail = t->tail;
}

void Splice(Curve *s, Cut cut_s, Curve *t) {
    assert(s != NULL); assert(t != NULL);
    Splice(s->a, cut_s.a, t->a);
    Splice(s->b, cut_s.b, t->b);
}

Curve* Solve(int L, int R, Cut &uplink, Cut &downlink) {
    //printf("nw %d %d\n", L, R);
    if(!flag) return new Curve();
    if(L > R) return new Curve(V[R]);
    if(st[L] != st[R]) {
        //puts("IN");
        Cut xx; // no use
        Curve* sub = Solve(L + 1, R - 1, xx, xx);
        sub->rev();
        Curve *u = new Curve(V[L - 1]), *v = new Curve(V[R]);
        //puts("OUt");
        if(st[L] == 0) {
            *u += *sub; *u += *v;
            //puts("OUT");
            uplink.a = u->a->head;
            uplink.b = u->b->tail;
            downlink.a = u->a->tail;
            downlink.b = u->b->head;
           // puts("OUT");
            return u;
        }
        else {
            *v += *sub; *v += *u;
            //puts("OUT");
            uplink.a = v->a->tail;
            uplink.b = v->b->head;
            downlink.a = v->a->head;
            downlink.b = v->b->tail;
            //puts("OUT");
            return v;
        }
    }
    else {
        int sp1 = 0, sp2 = 0, i, j;
        for(i = L, j = R;i < j; ++i, --j) {
            sp1 += (st[i] == 0 ? -1 : 1);
            sp2 += (st[j] == 0 ? -1 : 1);
            if(sp1 == 0 || sp2 == 0)
                break;
        }
        if(i >= j) {
            flag = false;
            return new Curve();
        }
        int k = !sp1 ? i : j - 1;
        Cut up1, dw1, up2, dw2;
        Curve *s = Solve(L, k, up1, dw1), *t = Solve(k + 1, R, up2, dw2);
        uplink = up1;
        Splice(s, dw1, t);
        downlink = dw2;
        return s;
    }
}
int main() {
    n = ri();
    for(int i = 1;i <= 2 * n; ++i) {
        int a = ri(), b = ri();
        A[i] = a; B[i] = b;
        way[i] = 1LL * a * b < 0 ? 1 : 0;
        if(a < 0) uto[-a] = i;
        else ufr[a] = i;
        if(b < 0) dto[-b] = i;
        else dfr[b] = i;
    }
    for(int i = 1;i <= n; ++i) {
        Mat(ufr[i], uto[i], 0);
        Mat(dfr[i], dto[i], 1);
    }
    for(int u = 1;u <= 2 * n; ++u)
        if(!vis[u]) {
            int c[2] = {0}, tp = 0, ty = 1;
            V[0] = u; vis[u] = true;
            c[1] = 1; int v = mat[tp & 1][u];
            st[tp = 1] = ty; V[tp] = v;
            for(;v != u;) {
                vis[v] = true;
                ty ^= way[v];
                v = mat[tp & 1][v];
                st[++tp] = ty;
                V[tp] = v;
                ++c[st[tp]];
            }
            if(abs(c[1] - c[0]) != 2) return puts("NO"), 0;
            if(c[1] == c[0] - 2) {
                for(int i = 1;i <= tp; ++i)
                    st[i] ^= 1;
            }
            if(st[1] != 1 || st[tp] != 1) {
                int ps;
                for(ps = 2;ps <= tp; ++ps)
                    if(st[ps] && st[ps - 1])
                        break;
                std::rotate(st + 1, st + ps, st + tp + 1);
                std::rotate(V, V + ps - 1, V + tp);
                V[tp] = V[0];
            }
            /*puts("RO");
            for(int i = 1;i <= tp; ++i)
                printf("%d ", st[i]);
            puts("");
            for(int i = 0;i < tp; ++i)
                printf("%d ", V[i]);
            puts("");*/
            Cut xx; //no use
            Curve *cur;
            cur = Solve(2, tp - 1, xx, xx);
            if(!flag) return puts("NO"), 0;
            if(A[V[0]] < 0) {
                for (Node *it = cur->b->head; it != NULL; it = it->next)
                    Ans[++cAns] = it->v;
                Ans[++cAns] = V[0];
            }
            else {
                Ans[++cAns] = V[0];
                for (Node *it = cur->a->head; it != NULL; it = it->next)
                    Ans[++cAns] = it->v;
            }
        }
    puts("YES");
    for(int i = 1;i <= cAns; ++i)
        printf("%d %d\n", A[Ans[i]], B[Ans[i]]);
    return 0;
}