#include <bits/stdc++.h>
using namespace std;
const int N = 100050, M = 1010, INF = 0x3f3f3f3f, mod = 1e9 + 7;
const double eps = 1e-6;
using namespace std;
int a[N];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline int read() {
  int date = 0, w = 1;
  char c = 0;
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    date = date * 10 + c - '0';
    c = getchar();
  }
  return date * w;
}
long long qmi(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
bool cmp(int first, int second) { return first > second; }
int main() {
  std::ios::sync_with_stdio(false);
  ;
  int n;
  cin >> n;
  for (int i = 0, first, second; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    ++a[u], ++a[v];
  }
  bool flag = true;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == 2) {
      flag = false;
      break;
    }
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
