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>
using namespace std;
typedef long long int_;
# define rep(i,a,b) for(int i=(a); i<=(b); ++i)
inline int readint(){
	int a = 0; char c = getchar(), f = 1;
	for(; c<'0'||c>'9'; c=getchar())
		if(c == '-') f = -f;
	for(; '0'<=c&&c<='9'; c=getchar())
		a = (a<<3)+(a<<1)+(c^48);
	return a*f;
}
inline void writeint(int x){
	if(x > 9) writeint(x/10);
	putchar((x-x/10*10)^48);
}

struct Curve{
	list<int> fw, bw;
	Curve(){
		fw.clear(); bw.clear();
	}
	Curve(int x){
		fw.push_back(x);
		bw.push_back(x);
	}
	Curve& operator += (Curve &t){
		fw.splice(fw.end(),t.fw);
		bw.swap(t.bw);
		bw.splice(bw.end(),t.bw);
		return *this;
	}
	Curve& reverse(){
		fw.swap(bw); return *this;
	}
};

const int MaxN = 400005;
int pos[2][2][MaxN]; // 0/1:front/back  0/1:open/close
int a[MaxN], b[MaxN];

bool vis[MaxN]; string s;
vector<int> path, sta, ans;
vector<Curve*> stnode;
int main(){
	int n = readint();
	for(int i=1; i<=(n<<1); ++i){
		a[i] = readint(), b[i] = readint();
		if(a[i] > 0) pos[0][0][a[i]] = i;
		else pos[0][1][-a[i]] = i;
		if(b[i] > 0) pos[1][0][b[i]] = i;
		else pos[1][1][-b[i]] = i;
	}
	for(int i=1; i<=(n<<1); ++i){
		if(vis[i]) continue;
		path.clear(), s.clear();
		/* get the path */ ;
		int x = i, cnt = 0;
		while(!vis[x]){
			vis[x] = true;
			path.push_back(x);
			cnt += (a[x] > 0);
			s.push_back('0'+(a[x]>0));
			if(a[x] < 0)
				x = pos[0][0][-a[x]];
			else x = pos[0][1][a[x]];

			vis[x] = true;
			path.push_back(x);
			cnt += (b[x] < 0);
			s.push_back('0'+(b[x]<0));
			if(b[x] < 0)
				x = pos[1][0][-b[x]];
			else x = pos[1][1][b[x]];
		}
		/* adjust order */ ;
		if(cnt < int(s.length()>>1)){
			int len = s.length();
			cnt = len-cnt; // flip
			rep(i,0,len-1)
				s[i] = '0'+'1'-s[i];
		}
		/* check consaint */ ;
		if(cnt != int(s.length()>>1)+1){
			puts("NO"); return 0;
		}
		/* find starting position */ ;
		int idx = 0;
		for(; s[idx]=='0'||s[idx+1]=='0'; ++idx);
		rotate(s.begin(),s.begin()+idx,s.end());
		rotate(path.begin(),path.begin()+idx,path.end());
		sta.clear(); stnode.push_back(new Curve(0));
		for(int j=int(s.length())-1; j>=2; --j)
			if(sta.empty() || s[sta.back()] == s[j]){
				sta.push_back(j);
				stnode.push_back(new Curve());
			}
			else{
				Curve *x = new Curve(j); // part I
				Curve *z = stnode.back(); // part II
				Curve *y = new Curve(sta.back()); // part III
				sta.pop_back(), stnode.pop_back();
				/* 0 + s + 1 */ ;
				if(s[j] == '0'){
					*x += *y; // inverted
					*x += z->reverse();
					*x += *stnode.back();
					stnode.pop_back(); // merge two
					stnode.push_back(x);
				}
				/* 1 + s + 0 */ ;
				if(s[j] == '1'){
					Curve *w = stnode.back();
					stnode.pop_back(); // merge two
					*w += z->reverse();
					*w += *y; *w += *x;
					stnode.push_back(w);
				}
			}
		Curve res = Curve(1);
		res += *stnode.back();
		if(a[path[1]] < 0)
			res.reverse();
		for(int sy : res.fw)
			ans.push_back(path[sy]);
		stnode.pop_back(); // last one
	}
	puts("YES");
	for(int sy : ans)
		printf("%d %d\n",a[sy],b[sy]);
	return 0;
}