func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 112345;   vector<int> v[N];   int read() {     int x;     scanf( %d , &x);     return x;   }   int cnt[N];   bool used[N];   bool t[N];   bool never[N];   int main() {     int n, m, i, j, x, y;     n = read();     for (i = 2; i <= n; i++) {       x = read();       y = read();       v[x].push_back(y);       cnt[x]++;       cnt[y]++;       v[y].push_back(x);     }     queue<int> q;     for (int i = 1; i <= n; i++) {       if (cnt[i] == 1) {         q.push(i);         used[i] = 1;       }     }     while (!q.empty()) {       int x = q.front();       q.pop();       for (int i = 0; i < v[x].size(); i++) {         int to = v[x][i];         if (!used[to]) {           if (cnt[to] <= 2 && !t[x] && !never[to]) {             used[to] = 1;             q.push(to);           } else if (cnt[to] == 3 && !t[x] && !never[to]) {             t[to] = 1;           } else {             never[to] = 1;           }           cnt[to]--;         }       }     }     for (i = 1; i <= n; i++) {       if (cnt[i] >= 3) {         puts( no );         return 0;       }     }     puts( yes );   }   