#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:134217728")
using namespace std;
const long long MOD = 998244353;
const long long MAXN = 100000 + 100;
vector<vector<int>> g;
int main() {
  int n;
  cin >> n;
  g.resize(n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < n; ++i) {
    if (g[i].size() == 2) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}
