func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e3 + 3;   int n, m, dp[N], vis[2][N];   vector<int> adj[2][N];   vector<pair<int, int>> e;   void dfs(int u, int dir) {     vis[dir][u] = 1;     for (int v : adj[dir][u])       if (!vis[dir][v]) dfs(v, dir);   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m;     for (int i = 0, u, v; i < m; i++) {       cin >> u >> v;       adj[0][u].push_back(v);       adj[1][v].push_back(u);       e.push_back({u, v});     }     dfs(1, 0), dfs(n, 1);     for (int i = 0; i < n - 1; i++)       for (auto [u, v] : e)         if (vis[0][u] & vis[1][v]) {           dp[u] = min(dp[u], dp[v] + 2);           dp[v] = min(dp[v], dp[u] - 1);         }     for (auto [u, v] : e)       if (vis[0][u] & vis[1][v] & (dp[u] > dp[v] + 2 || dp[v] > dp[u] - 1))         return cout <<  No  << endl, 0;     cout <<  Yes  << endl;     for (auto [u, v] : e)       cout << (vis[0][u] & vis[1][v] ? dp[u] - dp[v] : 1) << endl;   }   