#include <bits/stdc++.h>
using namespace std;
template <class T>
void rd(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}
const int maxn = 1e5 + 5;
int n;
int du[maxn];
int main() {
  rd(n);
  for (int i = (1); i <= (n - 1); ++i) {
    int u, v;
    rd(u), rd(v);
    du[u]++;
    du[v]++;
  }
  for (int i = (1); i <= (n); ++i)
    if (du[i] == 2) {
      puts("NO");
      exit(0);
    }
  return puts("YES"), 0;
}
