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<cstdio>
using namespace std;
const int N=4e5+5;
int l[N],r[N],L[N],R[N],b[N],ansl[N],ansr[N],cnt;
int cl[N],cr[N],c[N],d[N],tot,twt;
int n;
bool bo=true;
void gao(int l,int r,int f,int L,int R)
{
//	printf("%d %d %d %d %d\n",l,r,f,L,R);
//	for(int i=l;i<=r;i++)
//		printf("%d",c[i]);
//	printf("\n");
	if(L==R)
	{
		d[L]=++twt;
		return; 
	}
	if(c[l]==0&&c[r]==1)
	{
		if(f==0)
		{
			d[L]=++twt;
			gao(l+1,r-1,f^1,L+1,R-1);
			d[R]=++twt;
		}
		else
		{
			d[R]=++twt;
			gao(l+1,r-1,f^1,L+1,R-1);
			d[L]=++twt;
		}
	}
	else if(c[l]==1&&c[r]==0)
	{
		if(f==0)
		{
			d[R]=++twt;
			gao(l+1,r-1,f^1,L+1,R-1);
			d[L]=++twt;
		}
		else
		{
			d[L]=++twt;
			gao(l+1,r-1,f^1,L+1,R-1);
			d[R]=++twt;
		}
	}
	else
	{
		for(int kl=l,kr=r,suml=0,sumr=0;;kl++,kr--)
		{
			if(c[kl]==1)
				suml++;
			else
				suml--;
			if(suml==0)
			{
				gao(l,kl,f,L,L+kl-l+1);
				int k;
				for(k=L+kl-l+1;;k--)
				{
					if(d[k]==twt)
						break;
					d[k+R-(L+kl-l+1)]=d[k];
				}
				twt--;
				gao(kl+1,r,f,k,k+r-kl);
				break;
			}
			if(c[kr]==1)
				sumr++;
			else
				sumr--;
			if(sumr==0)
			{
				int tt=twt;
				twt+=kr-l;
				gao(kr,r,f,L,L+r-kr+1);
				int k;
				for(k=L+r-kr+1;;k--)
				{
					if(d[k]==tt+kr-l+1)
						break;
					d[k+R-(L+r-kr+1)]=d[k];
				}
				twt=tt;
				gao(l,kr-1,f,k,k+kr-l);
				twt=tt+R-L+1;
				break;
			}
		}
	} 
}
void solve()
{
	int s0=0,s1=0;
//	for(int i=1;i<=tot;i++)
//		printf("%d %d %d\n",c[i],cl[i],cr[i]);
//	printf("\n");
	for(int i=1;i<=tot;i++)
	{
		if(c[i])
			s1++;
		else
			s0++;
	}
	if(s1-s0!=2&&s1-s0!=-2)
	{
		bo=false;
//		if(n==8820)
//		for(int i=1;i<=tot;i++)
//			printf("%d %d\n",(cl[i]&1?-1:1)*(cl[i]>>1),(cr[i]&1?-1:1)*(cr[i]>>1));
		return;
	}
	if(s1-s0==-2)
	{
		for(int i=1;i<=tot;i++)
			c[i]=c[i]^1;
		for(int i=2;i<=tot;i++)
		{
			if(!(cl[i]&1)&&!(cr[i]&1)&&c[i]&&c[i-1])
			{
				for(int j=i;j<=tot;j++)
					d[j-i+1]=cl[j];
				for(int j=1;j<i;j++)
					d[tot-i+1+j]=cl[j];
				for(int j=1;j<=tot;j++)
					cl[j]=d[j];
				for(int j=i;j<=tot;j++)
					d[j-i+1]=cr[j];
				for(int j=1;j<i;j++)
					d[tot-i+1+j]=cr[j];
				for(int j=1;j<=tot;j++)
					cr[j]=d[j];
				for(int j=i;j<=tot;j++)
					d[j-i+1]=c[j];
				for(int j=1;j<i;j++)
					d[tot-i+1+j]=c[j];
				for(int j=1;j<=tot;j++)
					c[j]=d[j];
				break;
			}
		}
	}
	twt=0;
	d[1]=++twt;
	gao(2,tot-1,0,2,tot);
	for(int i=1;i<=tot;i++)
		ansl[++cnt]=cl[d[i]],ansr[cnt]=cr[d[i]];
}
void dfs(int u,int p)
{
//	printf("%d %d\n",u,p);
	if(b[u])
	{
		solve();
		return;
	}
	b[u]=1;
	tot++;
	cl[tot]=l[u];
	cr[tot]=r[u];
	int v;
	if(p==1)
	{
//		tot++; 
		c[tot]=(r[u]&1)^1;
		v=R[r[u]^1];
	}
	else
	{
//		tot++;
		c[tot]=(l[u]&1);
		v=L[l[u]^1];
	}
	dfs(v,p^1);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)
	{
		scanf("%d%d",&l[i],&r[i]);
		if(l[i]>0)
			l[i]=l[i]<<1;
		else
			l[i]=(-l[i])<<1|1;
		if(r[i]>0)
			r[i]=r[i]<<1;
		else
			r[i]=(-r[i])<<1|1;
		L[l[i]]=i;R[r[i]]=i;
	}
	for(int i=1;i<=2*n;i++)
	if(!(l[i]&1)&&!(r[i]&1)&&b[i]==0)
	{
		tot=0;
		dfs(i,1);
		if(!bo)
		{
			printf("NO");
			return 0;
		}
	}
	if(cnt<2*n)
	{
		printf("NO");
		return 0;
	}
	printf("YES\n");
	for(int i=1;i<=2*n;i++)
	{
		if(ansl[i]&1)
			printf("-");
		printf("%d ",ansl[i]>>1);
		if(ansr[i]&1)
			printf("-");
		printf("%d\n",ansr[i]>>1);
	}
}