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 No() puts("NO"),exit(0)
using namespace std;
int n,a[400010],b[400010],La[200010],Ra[200010],Lb[200010],Rb[200010],nxt[400010],st[400010],t;
int S[400010],T[400010],l[400010],r,ans[400010],op=0;
bool vis[400010];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n*2;i++){
		scanf("%d%d",&a[i],&b[i]);
		abs(a[i])[a[i]>0?La:Ra]=i;
		abs(b[i])[b[i]>0?Lb:Rb]=i;
	}
	for(int i=1;i<=n*2;i++) if(!vis[i]&&a[i]>0&&b[i]>0){
		t=0;
		for(int nw=i;!vis[nw];){
			vis[st[++t]=nw]=true;
			if(t&1) nw=a[nw]>0?Ra[a[nw]]:La[-a[nw]];
			else nw=b[nw]>0?Rb[b[nw]]:Lb[-b[nw]];
		}
		int cnt[2][2]={};
		for(int j=1;j<=t;j++) cnt[(j&1?a[st[j]]:b[st[j]])>0][j&1]++;
		if(abs(cnt[0][0]-cnt[0][1])!=1||abs(cnt[1][0]-cnt[1][1])!=1) No();
		r=-1;
		for(int j=1;j<=t;j++){
			if(r>0&&l[r]==l[r-1]){
				int x=S[r],y=T[r];
				r--;
				if(l[r]){
					nxt[T[r]]=x;
					nxt[y]=st[j];
					T[r]=st[j];
				}
				else{
					nxt[st[j]]=x;
					nxt[y]=S[r];
					S[r]=st[j];
				}
			}
			else ++r,S[r]=T[r]=st[j];
			l[r]=(j&1?a[st[j]]:b[st[j]])>0;
		}
		if(r==3) nxt[T[0]]=S[3],nxt[T[3]]=S[2];
		for(int nw=S[l[1]];nw;nw=nxt[nw]) ans[++op]=nw;
		for(int nw=S[l[0]];nw;nw=nxt[nw]) ans[++op]=nw;
	}
	if(op!=2*n) No();
	puts("YES");
	for(int i=1;i<=2*n;i++) printf("%d %d\n",a[ans[i]],b[ans[i]]);
}