#include <bits/stdc++.h>
using namespace std;
const int inf = (1ll << 31) - 1;
const long long INF = (1ull << 63) - 1;
template <typename T>
void read(T &x) {
  x = 0;
  bool f = 1;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = 0;
  } while (ch > '9' || ch < '0');
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  x = f ? x : -x;
}
template <typename T>
void write(T x) {
  if (x < 0) x = ~x + 1, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void Ckmax(T &x, T y) {
  if (x == -1) x = y;
  x = x > y ? x : y;
}
template <typename T>
void Ckmin(T &x, T y) {
  if (x == -1) x = y;
  x = x < y ? x : y;
}
template <typename T>
void Swap(T &x, T &y) {
  x ^= y ^= x ^= y;
}
template <typename T>
T Abs(T x) {
  return x > 0 ? x : -x;
}
template <typename T>
void Add(T &x, T v, T mod) {
  x += v;
  x = x >= mod ? x - mod : x;
}
template <typename T>
void Del(T &x, T v, T mod) {
  x -= v;
  x = x < 0 ? x + mod : x;
}
const int N = 1e6 + 7;
int n, a[N];
int main() {
  read(n);
  for (int i = 1, u, v; i < n; i++) {
    read(u);
    read(v);
    a[u]++;
    a[v]++;
  }
  for (int i = 1; i <= n; i++)
    if (a[i] == 2) {
      puts("NO");
      exit(0);
    }
  puts("YES");
  return 0;
}
