#include <bits/stdc++.h>
using namespace std;
const int maxn = 100086;
const int maxm = 100086;
const int inf = 0x3f3f3f3f;
const long long Inf = 999999999999999999;
const int mod = 1000000007;
const double eps = 1e-6;
const double pi = acos(-1);
int n;
int num[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x;
    scanf("%d", &x);
    num[x]++;
    scanf("%d", &x);
    num[x]++;
  }
  bool flag = true;
  for (int i = 0; i < maxn; i++) {
    if (num[i] == 2) {
      flag = false;
    }
  }
  if (flag) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}
