#include <bits/stdc++.h>
using namespace std;
const int len = 2e5 + 10;
const double pi = acos(-1.0);
const long long mod = 998244353;
const int inf = 0x3f3f3f3f;
const int maxn = 1e9 + 5;
vector<int> g[len];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int f = 0;
  for (int i = 1; i <= n; i++) {
    if (g[i].size() == 2) f = 1;
  }
  if (f) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
  return 0;
}
