func_code_string: #include <bits/stdc++.h>   using namespace std;   const int S = 100009;   vector<int> in[S];   vector<int> out[S];   bool viz[S];   int moa[S];   vector<int> topol;   vector<int> rang[S];   void dfs(int a) {     if (viz[a]) return;     viz[a] = 1;     for (auto u : out[a]) dfs(u);     topol.push_back(a);   }   void sfd(int a, int c) {     if (moa[a] != -1) return;     moa[a] = c;     for (auto u : in[a]) sfd(u, c);   }   int main() {     memset(moa, -1, sizeof moa);     int n, v;     cin >> n;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         scanf( %i , &v);         if (v != 0) {           in[i].push_back(j);           out[j].push_back(i);         }       }     }     for (int i = 1; i <= n; i++) dfs(i);     int r = 0, u;     for (int i = n - 1; i > -1; i--) {       u = topol[i];       if (moa[u] == -1) {         sfd(u, r);         r++;       }     }     for (int i = 1; i <= n; i++) {       if (moa[i] != moa[1]) {         printf( NO );         return 0;       }     }     printf( YES );   }   