func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, u, v, num_col = 1;   vector<int> adjList[5001];   vector<int> edges[5001];   bitset<5001> vis;   bitset<5001> act;   bitset<5001> col;   void dfs(int nd) {     vis[nd] = 1;     act[nd] = 1;     for (int k = 0; k < adjList[nd].size(); k++) {       int nd_b = adjList[nd][k];       int edge_num = edges[nd][k];       if (!vis[nd_b])         dfs(nd_b);       else if (act[nd_b]) {         num_col = 2;         col[edge_num] = 1;       }     }     act[nd] = 0;   }   int main() {     cin >> n >> m;     for (int i = 0; i < m; i++) {       cin >> u >> v;       u--;       v--;       adjList[u].push_back(v);       edges[u].push_back(i);     }     for (int i = 0; i < n; i++) {       if (!vis[i]) dfs(i);     }     cout << num_col << endl;     for (int i = 0; i < m; i++) {       cout << (((int)col[i]) + 1) << (i < m - 1 ?     :   );     }     cout << endl;     return 0;   }   