func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 100005;   const int maxm = 300005;   int n, m, cnt1, cnt2, ans;   int head[maxn], Head[maxn];   int dis1[maxn], vis1[maxn];   int use1[maxn], use2[maxn];   int num[maxn], ok[maxn];   struct nood {     int nex, to, w;     int fr;   };   nood e[maxm], E[maxm];   inline void jia(int u, int v, int c) {     e[++cnt1].nex = head[u];     e[cnt1].fr = u;     head[u] = cnt1;     e[cnt1].to = v;     e[cnt1].w = c;   }   inline void Jia(int u, int v, int c) {     E[++cnt2].nex = Head[u];     Head[u] = cnt2;     E[cnt2].to = v;     E[cnt2].w = c;   }   inline void dfs(int u) {     use1[u] = 1;     for (int i = head[u]; i; i = e[i].nex) {       int v = e[i].to;       if (use1[v]) continue;       dfs(v);     }   }   inline void Dfs(int u) {     use2[u] = 1;     for (int i = Head[u]; i; i = E[i].nex) {       int v = E[i].to;       if (use2[v]) continue;       Dfs(v);     }   }   inline void spfa(int s) {     queue<int> q;     memset(dis1, 127 / 3, sizeof(dis1));     memset(vis1, 0, sizeof(vis1));     q.push(s), dis1[s] = 0;     num[s] = 1, vis1[s] = 1;     while (!q.empty()) {       int u = q.front();       q.pop();       vis1[u] = 0;       for (int i = Head[u]; i; i = E[i].nex) {         int v = E[i].to;         if (dis1[v] > dis1[u] + E[i].w) {           dis1[v] = dis1[u] + E[i].w;           if (!vis1[v]) {             vis1[v] = 1;             q.push(v);             num[v]++;           }           if (num[v] > n) {             printf( No n );             exit(0);           }         }       }     }   }   inline int read() {     int sum = 0;     char ch = getchar();     while (!isdigit(ch)) ch = getchar();     while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();     return sum;   }   int main() {     n = read();     m = read();     for (int i = 1; i <= m; i++) {       int u = read();       int v = read();       jia(u, v, 0);       Jia(v, u, 0);     }     dfs(1);     Dfs(n);     for (int i = 1; i <= n; i++)       if (use1[i] && use2[i]) ok[i] = 1;     if (!use1[n]) return printf( No n ), 0;     memset(E, 0, sizeof(E));     memset(Head, 0, sizeof(Head));     cnt2 = 0;     ok[1] = 1, ok[n] = 1;     for (int i = 1; i <= m; i++) {       int u = e[i].fr;       int v = e[i].to;       if (ok[u] && ok[v]) {         Jia(u, v, -1);         Jia(v, u, 2);       }     }     spfa(1);     printf( Yes n );     for (int i = 1; i <= m; i++) {       int u = e[i].fr;       int v = e[i].to;       if (ok[u] && ok[v])         printf( %d n , abs(dis1[u] - dis1[v]));       else         printf( 1 n );     }     return 0;   }   