#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 998244353;
constexpr long long mod = 1e9 + 7;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const long long N = 3e5 + 5;
vector<long long> adj[N];
long long power(long long n, long long p) {
  if (p == 0) return 1;
  if (p == 1) return n;
  if (p % 2)
    return power(n, p - 1) * n;
  else {
    long long x = power(n, p / 2);
    return x * x;
  }
}
long long modpow(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
long long nsum(long long num) { return (num * (num + 1)) / 2; }
void edge(long long u, long long v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
long long cnt[N];
bool ck;
void solve() {
  long long n;
  string s;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    cnt[x]++, cnt[y]++;
  }
  for (long long i = 1; i <= n; i++)
    if (cnt[i] == 2) ck = true;
  if (ck)
    cout << "NO"
         << "\n";
  else
    cout << "YES"
         << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long Test = 1;
  while (Test--) {
    solve();
  }
  return 0;
}
