func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxN = 2000 + 5;   int n, mark[maxN], m, st[maxN], start, high[maxN], on[maxN], cnt;   vector<int> adj[maxN];   vector<int> s;   void DFS(int v) {     s.push_back(v);     on[v] = mark[v] = 1;     st[v] = high[v] = start++;     for (int i = 0; i < adj[v].size(); i++) {       int x = adj[v][i];       if (mark[x]) {         if (on[x]) high[v] = min(high[v], high[x]);       } else {         DFS(x);         high[v] = min(high[v], high[x]);       }     }     if (st[v] == high[v]) {       int x = s.back();       while (!s.empty() && st[x] >= st[v]) {         on[x] = 0;         s.pop_back();         x = s.back();       }       cnt++;     }   }   int main() {     ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     cin >> n;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         int x;         cin >> x;         if (x) adj[i].push_back(j);       }     }     for (int i = 0; i < n; i++)       if (!mark[i]) DFS(i);     if (cnt == 1)       cout <<  YES n ;     else       cout <<  NO n ;     return 0;   }   