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<int> tree[n + 1];     for (int i = 2; i <= n; i++) {       int p;       cin >> p;       tree[p].push_back(i);     }     bool is_spruce = true;     for (int i = 1; i <= n; i++) {       if (tree[i].empty())         continue;       else {         int count = 0;         for (auto c : tree[i]) {           if (count == 3) break;           if (tree[c].size() == 0) count++;         }         if (count != 3) {           is_spruce = false;           break;         }       }     }     if (is_spruce)       cout <<  Yes  << endl;     else       cout <<  No  << endl;   }   