#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1111111;
inline int read() {
  int X = 0;
  bool flag = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    X = (X << 1) + (X << 3) + ch - '0', ch = getchar();
  if (flag) return X;
  return (X - 1);
}
int a[MAXN];
int main() {
  int n = read();
  for (int i = 1; i < n; i++) {
    int x = read(), y = read();
    a[x]++, a[y]++;
  }
  for (int i = 1; i <= n; i++)
    if (a[i] == 2) puts("NO"), exit(0);
  puts("YES");
  return 0;
}
