# 参考程序

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define maxn 400005
#define maxm 1000005
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(a,b) make_pair(a,b)
#define pi pair<int,int>
#define pb(x) push_back(x)
#define mo 4000000
using namespace std;

vector<pi> vc[maxn];

struct note{
int x,y;
}a[maxm];

int head[maxn],t[maxm * 2],next[maxm * 2],sum;

int dir[maxm],deep[maxn],fa[maxn],now[maxn],pfa[maxn];

bool bz[maxn];

int Test,n,m,S,T;

pi d[maxn * 10];

int ret=0,ff=1;
char c=getchar();
while (c<'0' || c>'9') {
if (c=='-') ff=-1;
c=getchar();
}
while (c>='0' && c<='9') {
ret=ret*10+c-'0';
c=getchar();
}
return ret*ff;
}

void insert(int x,int y){
t[++sum]=y;
}

void dfs(int x,int father) {
deep[x]=deep[father]+1;
if (t[tmp]==father) continue;
if (!bz[t[tmp]]) {
bz[t[tmp]]=1;
fa[t[tmp]]=x;
now[x]=t[tmp];
pfa[t[tmp]]=tmp / 2;
dfs(t[tmp],x);
}
else if (deep[t[tmp]]<deep[x]) {
vc[now[t[tmp]]].pb(mp(x,tmp / 2));
}
}
}

int main(){
while (Test--) {
sum=1;
///
fo(i,1,m) {
dir[i]=-1;
a[i].x=x;
a[i].y=y;
insert(x,y);
insert(y,x);
}
bz[S]=1;
dfs(S,0);
fa[S]=S;
if (!bz[T]) {
puts("No");
continue;
}
int l=0,r=1;
d[1]=mp(T,1);
while (l!=r) {
l=(l+1) % mo;
int nowdir=d[l].se,w=d[l].fi;
while (fa[w]!=w && dir[pfa[w]]==-1) {
dir[pfa[w]]=nowdir;
if (!vc[w].empty())
fo(i,0,vc[w].size()-1){
dir[vc[w][i].se]=nowdir;
r=(r+1) % mo;
d[r]=mp(vc[w][i].fi,nowdir ^ 1);
}
w=fa[w];
}
}
bool ans=1;
fo(i,1,m)
if (dir[i]==-1)
ans=0;
if (!ans) {
puts("No");
continue;
}
puts("Yes");
fo(i,1,m) {
int x=a[i].x,y=a[i].y;
if (dir[i]) {
if (deep[x]<deep[y]) printf("%d %d\n",x,y);
else printf("%d %d\n",y,x);
}
else {
if (deep[x]<deep[y]) printf("%d %d\n",y,x);
else printf("%d %d\n",x,y);
}
}
}
return 0;
}

• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120