#include <bits/stdc++.h>
using namespace std;
const int maxn = 100050;
int d[maxn];
int n;
void solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    d[u]++;
    d[v]++;
  }
  int flag = 1;
  for (int i = 1; i <= n; i++) {
    if (d[i] == 2) {
      flag = 0;
      break;
    }
  }
  printf("%s\n", flag ? "YES" : "NO");
}
int main() {
  solve();
  return 0;
}
