#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1e5 + 10,M = 4e5 + 10;
int n,m,type;
int h[N],e[M],ne[M],idx;
int ans[M],din[N],dout[N];
bool used[M];
int cnt;
void add(int a,int b){
e[idx] = b,ne[idx] = h[a],h[a] = idx++;
}
void dfs(int u){
for(int &i=h[u];i!=-1;){
if(used[i]){
i = ne[i];
continue;
}
used[i] = true;
if(type == 1) used[i ^ 1] = true;
int t;
if(type == 1){
t = i / 2 + 1;
if(i & 1) t = -t;
}
else t = i + 1;
int j = e[i];
i = ne[i];
dfs(j);
ans[cnt++] = t;
}
}
int main()
{
scanf("%d %d %d",&type,&n,&m);
memset(h, -1, sizeof h);
for(int i=0;i<m;i++){
int a,b;
scanf("%d %d",&a,&b);
add(a,b);
if(type == 1) add(b,a);
din[b]++,dout[a]++;
}
if(type == 1){
for(int i=1;i<=n;i++){
if((din[i] + dout[i]) & 1){
puts("NO");
return 0;
}
}
}
else{
for(int i=1;i<=n;i++){
if(din[i] != dout[i]){
puts("NO");
return 0;
}
}
}
for(int i=1;i<=n;i++){
if(~h[i]){
dfs(i);
break;
}
}
if(cnt < m){
puts("NO");
return 0;
}
puts("YES");
for(int i=cnt-1;i>=0;i--){
printf("%d ",ans[i]);
}
return 0;
}