#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f;
const int N = 4e5 + 10;
const int mod = 998244353;
const bool _debug = false;
int si[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; ++i) {
    scanf("%d%d", &u, &v);
    si[u]++;
    si[v]++;
  }
  for (int i = 1; i <= n; ++i)
    if (si[i] == 2) {
      puts("NO");
      return 0;
    }
  puts("YES");
  return 0;
}
