#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;
}
