#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const int M = int(7e5) + 10;
const int inf = int(1e9);
const int mod = int(1e9) + 7;
const long double eps = 1e-15;
vector<int> g[N];
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; ++i) {
    if (g[i].size() == 2) {
      puts("NO");
      return;
    }
  }
  puts("YES");
}
int main() {
  solve();
  return 0;
}
