#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n;
int a, b;
int num[maxn];
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    num[a]++;
    num[b]++;
  }
  int flag = 1;
  for (int i = 0; i < maxn; i++) {
    if (num[i] == 2) {
      flag = 0;
    }
  }
  if (flag == 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
