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 EF emplace_front
#define EB emplace_back
using std::cin;
using std::cout;

typedef std::pair <int, int> pr;
typedef std::list <int> list;
const int N = 400054;

struct curve {
	list li, lir;
	list::iterator out, outr;

	inline void base(int x) {
		li.clear(), lir.clear(), li.EB(x), lir.EB(x), 
		out = li.begin(), outr = lir.begin();
	}

	inline void reverse() {li.swap(lir), std::swap(out, outr);}

	inline curve & wrapPos(int l, int r) {
		reverse(),
		li.EF(r), li.EB(l), out = li.begin(), lir.EF(l), lir.EB(r), --(outr = lir.end());
		return *this;
	}

	inline curve & wrapNeg(int l, int r) {
		reverse(),
		li.EF(l), li.EB(r), --(out = li.end()), lir.EF(r), lir.EB(l), outr = lir.begin();
		return *this;
	}

	void join(curve &rhs) {
		li.splice(out, rhs.li), li.erase(out), out = rhs.out,
		lir.splice(outr, rhs.lir), lir.erase(outr), outr = rhs.outr;
	}
} c[N];

int n, m, A;
pr a[N];
int belU[N], belD[N];
int seq[N], stack[N], ans[N];
bool used[N], rev[N];

inline int tr(int x) {return x >= 0 ? 2 * (x - 1) : ~(2 * x);}
inline int Tr(int x) {return x & 1 ? ~x / 2 : x / 2 + 1;}

bool construct() {
	int i, s = 0, ss = 0;
	for (i = 0; i < m; ++i) s += (rev[i] ? -1 : 1);
	if (s != -2 && s != 2) return false;
	if (s == -2) {
		std::reverse(seq, seq + m), std::reverse(rev, rev + (m - 1));
		for (i = 0; i < m; ++i) rev[i] = !rev[i];
	}
	if (rev[0] || rev[m - 1]) {
		for (i = 2; i < m && (rev[i - 1] || rev[i]); i += 2);
		assert(i != m), std::rotate(seq, seq + i, seq + m), std::rotate(rev, rev + i, rev + m);
	}
	s = 0, c->base(1);
	for (i = 1; i < m - 1; ++i, s = ss) {
		ss = s + (rev[i] ? -1 : 1);
		if (abs(ss) > abs(s))
			stack[abs(ss)] = i, c[abs(ss)].base(i + 1);
		else if (s >= 0)
			c[ss].join(c[s].wrapPos(stack[s], i + 1));
		else
			c[-ss].join(c[-s].wrapNeg(stack[-s], i + 1));
	}
	ans[A++] = *seq;
	for (int idx : c->li) ans[A++] = seq[idx];
	return true;
}

int main() {
	int i, j, u, v, x;
	std::ios::sync_with_stdio(false), cin.tie(nullptr);
	cin >> n;
	for (i = 0; i < 2 * n; ++i)
		cin >> u >> v, a[i] = pr(u = tr(u), v = tr(v)), belU[u] = belD[v] = i;
	for (i = 0; i < n; ++i) if (!used[i]) {
		m = 0, j = i << 1, x = belU[j],
		u = belU[j], v = belU[j ^ 1], used[j >> 1] = true;
		for (; ; ) {
			seq[m] = u, rev[m++] = j & 1,
			j = a[v].second,
			u = v, v = belD[j ^ 1],
			seq[m] = u, rev[m++] = !(j & 1),
			j = a[v].first, used[j >> 1] = true,
			u = v, v = belU[j ^ 1];
			if (u == x) break;
		}
		if (!construct()) return cout << "NO\n", 0;
	}
	assert(A == 2 * n), cout << "YES\n";
	for (i = 0; i < A; ++i) cout << Tr(a[ans[i]].first) << ' ' << Tr(a[ans[i]].second) << '\n';
	return 0;
}