#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace chrono;
long long int number_of_numbers_between_l_and_r_div_by_k(long long int l,
                                                         long long int r,
                                                         long long int k) {
  long long int n = (r + k) / k - (l - 1 + k) / k;
  return n;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
unsigned long long power(unsigned long long x, int y, int p) {
  unsigned long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
std::vector<long long int> g[2 * 100005];
long long int vis[2 * 100005] = {0};
void dfs(long long int x) {
  vis[x] = 1;
  long long int j;
  for (j = 0; j < g[x].size(); j++) {
    if (vis[g[x][j]] == 0) {
      dfs(g[x][j]);
    }
  }
}
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  auto start1 = high_resolution_clock::now();
  long long int t, i, j, x, y, n, k, z, p;
  cin >> n;
  map<long long int, long long int> mp;
  for (i = 0; i < n - 1; i++) {
    cin >> x >> y;
    mp[x]++;
    mp[y]++;
  }
  for (j = 1; j <= n; j++) {
    if (mp[j] == 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  auto stop1 = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop1 - start1);
}
