#include <bits/stdc++.h>
using namespace std;
struct S {
  int a, b;
  S() {}
  S(int _a, int _b) {
    a = _a;
    b = _b;
  }
  const bool operator<(const S &o) const { return a < o.a; }
};
priority_queue<int, vector<int>, greater<int>> mpq;
const int SPACE = 0, NL = 1;
string exm;
inline void showAll(vector<int> &v, int sep) {
  for (int &here : v) printf("%d%c", here, (sep) ? '\n' : ' ');
}
inline void exf(void) {
  cout << exm << "\n";
  exit(0);
}
inline vector<int> int_seperation(int N, int d = 10) {
  vector<int> v;
  while (N) {
    v.push_back(N % d);
    N /= d;
  }
  reverse(v.begin(), v.end());
  return v;
}
const int SIZE = 100009;
vector<int> tree[SIZE];
int deg[SIZE] = {0};
int main() {
  int V;
  scanf("%d", &V);
  for (int i = 0; i < V - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    deg[u]++;
    deg[v]++;
  }
  if (V == 2) {
    printf("YES\n");
    return 0;
  }
  exm = "NO";
  for (int i = 1; i <= V; i++) {
    if (deg[i] == 2) {
      exf();
    }
  }
  printf("YES\n");
  return 0;
}
