func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     cin >> n;     vector<vector<int> > adj(n, vector<int>(n, 0));     set<int> s;     int x;     for (int i = 2; i < n + 1; i++) {       cin >> x;       adj[x - 1][i - 1] = 1;       s.insert(x - 1);     }     stack<int> st;     int i = 0;     int j;     int count = 0;     while (i < n) {       if (s.find(i) == s.end()) {         i++;         continue;       }       for (j = 0; j < n; j++) {         if (adj[i][j] == 1 && (s.find(j) == s.end())) {           count++;         }       }       if (count < 3) {         cout <<  No  << endl;         return 0;       }       count = 0;       i++;     }     cout <<  Yes  << endl;     return 0;   }   