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>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define abs(x) ((x)>0?(x):-(x))
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define ll long long
using namespace std;

int n,i,j,k,l,x,y,ls;
int a[2][200001][2];
int X[400001],Y[400001];
bool bz[400001];
int ans[400001];
int d[800001],t;
int nxt[1600001][2],id[1600001],tot;
int sum[2];
struct type{int x,y,U,D;} S;

void Exit() {printf("NO\n");exit(0);}
int nx(int t,int x)
{
	int y=(x>0)?0:1;
	x=abs(x);
	return a[t][x][y^1];
}

int New(int x)
{
	++tot;
	nxt[tot][0]=nxt[tot][1]=0,id[tot]=x;
	return tot;
}
void link(int x,int y,int tp) {nxt[x][tp]=y,nxt[y][tp^1]=x;}
type work(int x,int y,int tp)
{
	int i,j,k,l,s1=0,s2=0,X,Y,z,P,N;
	type S,S1,S2;
	if (x==y) {X=New(d[x]); return type{X,X,X,X};}
	
	if (d[x+1]!=d[y-1])
	{
		S=work(x+2,y-2,tp^1),swap(S.x,S.y);
		X=New(d[x]),Y=New(d[y]);
		if (!d[x+1])
		{link(X,S.x,tp),link(S.y,Y,tp); return type{X,Y,X,Y};}
		else
		{link(Y,S.x,tp),link(S.y,X,tp); return type{Y,X,X,Y};}
	}
	else
	{
		k=x+2,l=y-2;
		while (k<=l)
		{
			s1+=d[k-1]?1:-1;
			s2+=d[l+1]?1:-1;
			z=0;
			if (!s1) z=k;
			if (!s2) z=l;
			if (z)
			{
				S1=work(x,z,tp),S2=work(z,y,tp);
				P=nxt[S2.U][tp^1],N=nxt[S2.U][tp];
				link(P,S1.x,tp),link(S1.y,N,tp);
				if (P) S1.x=S2.x;
				if (N) S1.y=S2.y;
				return S1;
			}
			k+=2,l-=2;
		}
		Exit();
	}
}

void build(int i)
{
	sum[0]=0,sum[1]=2;
	bz[i]=bz[nx(1,Y[i])]=1;
	j=nx(0,X[i]),k=1,t=1,d[1]=j;
	while (!bz[j])
	{
		bz[j]=1;
		if (!k)
		{
			if (X[j]>0) d[++t]=1; else d[++t]=0;
			j=nx(0,X[j]);
		}
		else
		{
			if (Y[j]<0) d[++t]=1; else d[++t]=0;
			j=nx(1,Y[j]);
		}
		++sum[d[t]],d[++t]=j;k^=1;
	}
}

int main()
{
	scanf("%d",&n);
	fo(i,1,n*2)
	{
		scanf("%d%d",&x,&y);
		if (x>0) a[0][x][0]=i; else a[0][-x][1]=i;
		if (y>0) a[1][y][0]=i; else a[1][-y][1]=i;
		X[i]=x,Y[i]=y;
	}
	
	ls=0;
	fo(i,1,n*2)
	if (!bz[i] && X[i]>0 && Y[i]>0)
	{
		x=i,build(i);
		if (sum[0]>sum[1])
		{
			fo(j,1,t) if (j&1) bz[d[j]]=0;
			bz[i]=bz[nx(1,Y[i])]=0;
			fo(j,3,t-2) if ((j&1) && X[d[j]]>0 && Y[d[j]]>0 && !d[j-1] && !d[j+1]) {x=d[j]; break;}
			build(x);
		}
		
		++ls,ans[ls]=x;tot=0;
		S=work(1,t,0);
		l=0;
		while (S.x)
		{
			ans[++ls]=id[S.x];
			fo(j,0,1)
			if (nxt[S.x][j] && !nxt[S.x][j^1] || nxt[S.x][j]!=l)
			{
				l=S.x,S.x=nxt[S.x][j];
				break;
			}
			if (j>1) break;
		}
	}
	fo(i,1,n*2) if (!bz[i]) Exit();
	
	printf("YES\n");
	fo(i,1,n*2) printf("%d %d\n",X[ans[i]],Y[ans[i]]);
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}