#include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
#define rep(i,n) for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; i>=0; i--)
#define print(a) cout<<a<<endl
typedef long long ll;
#define yn(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YN(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define so(a) sort(a.begin(),a.end())
#define mp make_pair
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define pb push_back
#define a2i(a,s) (ll)(a-s)
#define i2a(s,a) (char)(s+a)
#define ssize(a) a.size()
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<pair<ll,ll>,ll> P3;
typedef pair<pair<ll,ll>,pair<ll,ll>> P4;
typedef pair<ll, ll> Pll;
typedef pair<ll,Pll> Plll;
typedef pair<Pii, int> Piii;
const ll INF = 1000000000000000000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
vector<ll> g[200009];
vector<ll> visited(200009);//通ったかどうか
void MakeMove(ll v){
cout<<v<<endl;
}
int GetMove(){
ll v;
cin>>v;
return v;
}
vector<ll> rank2(200009);
vector<ll> s(200009);//頂点iが1と繋がっているか
vector<ll> match_path[200009];
bool t=false;
int dfs(ll pos){
vector<ll> unmatched;
visited[pos]=1;
if(s[pos]==1)unmatched.push_back(pos);
for(auto nx:g[pos]){
if(visited[nx]==0){
ll j=dfs(nx);
if(j!=-1){
match_path[j].push_back(pos);
unmatched.push_back(j);
}
}
}
while(unmatched.size()>=2){
ll a=unmatched.back();
unmatched.pop_back();
ll b=unmatched.back();
unmatched.pop_back();
for(ll c=match_path[b].size()-2;c>=0;c--){
match_path[a].push_back(match_path[b][c]);
}
if(match_path[a].size()==0||match_path[a].back()!=b)match_path[a].pb(b);
match_path[b].clear();
for(ll c=match_path[a].size()-2;c>=0;c--){
match_path[b].push_back(match_path[a][c]);
}
if(match_path[b].size()==0||match_path[b].back()!=a)match_path[b].pb(a);
}
if(unmatched.size()==0)return -1;
return unmatched[0];
}
int main(){
//入力
// cin.tie(0);
// ios::sync_with_stdio(0);
ll n,m;
cin>>n>>m;
for(ll i=0;i<m;i++){
ll a,b;
cin>>a>>b;
if(a==1)s[b]=1;
else if(b==1)s[a]=1;
else{
g[a].push_back(b);
g[b].push_back(a);
}
}
if(g[1].size()%2==1){
cout<<"NO"<<endl;
return 0;
}
for(ll i=2;i<=n;i++){
if(s[i]==1&&visited[i]==0){
ll j=dfs(i);
if(j!=-1){
cout<<"NO"<<endl;
return 0;
}
}
}
//勝負
cout<<"YES"<<endl;
while(1){
ll nx=GetMove();
if(nx==0)return 0;
for(auto nx2:match_path[nx]){
MakeMove(nx2);
}
MakeMove(1);
}
return 0;
}