#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;
}