#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 10;
const int MAXN = 5e4 + 10;
long long mul(long long x, long long y) { return (x * 1ll * y) % 1000000007; }
long long add(long long x, long long y) {
  x += y;
  while (x >= 1000000007) x -= 1000000007;
  while (x < 0) x += 1000000007;
  return x;
}
bool isPrime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
void solve() {
  int n;
  cin >> n;
  int x, y;
  vector<int> v(MAX);
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    v[x] += 1;
    v[y] += 1;
  }
  for (int i = 0; i <= n; i++) {
    if (v[i] == 2) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  while (tc--) solve();
}
