#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[200005];
bool vis[1005];
long long int level[1005];
void bfs(long long int s) {
  vis[s] = true;
  level[s] = 0;
  queue<long long int> q;
  q.push(s);
  while (!q.empty()) {
    long long int p = q.front();
    q.pop();
    for (long long int i = 0; i < adj[p].size(); i++) {
      if (vis[adj[p][i]] == false) {
        level[adj[p][i]] = level[p] + 1;
        q.push(adj[p][i]);
        vis[adj[p][i]] = true;
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n - 1; i++) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  long long int flag = 0;
  for (long long int i = 1; i <= n; i++) {
    if (adj[i].size() == 2) {
      flag++;
      break;
    }
  }
  if (flag > 0) {
    cout << "NO";
  } else {
    cout << "YES";
  }
}
