#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int inf = 1e9 + 1e8;
const long long INF = 1e18 + 1e17;
const int MOD1 = 998244353;
const int MOD2 = 1e9 + 7;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
bool is_prime(int x) {
  if (x == 1 || (!(x % 2) && x > 2)) return false;
  for (int i = 3; i * i <= x; i += 2) {
    if (!(x % i)) {
      return false;
    }
  }
  return true;
}
bool is_palindrome(string str) {
  for (int i = 0; i < str.length() / 2; i++) {
    if (str[i] != str[str.length() - 1 - i]) {
      return false;
    }
  }
  return true;
}
long long NCR(int n, int r) {
  if (n < r || r < 0 || n <= 0) return 0;
  if (r > n / 2) return NCR(n, n - r);
  long long res = 1;
  for (long long k = 1; k <= r; k++) {
    res *= n - k + 1;
    res /= k;
  }
  return res;
}
int N;
int cnt[MAXN];
int main() {
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int u, w;
    cin >> u >> w;
    cnt[u]++;
    cnt[w]++;
  }
  for (int i = 1; i <= N; i++) {
    if (cnt[i] == 2) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
