#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[2] = {0, 1};
int diry[2] = {1, 0};
int spf[1000000];
inline string IntToString(long long a) {
  char x[100];
  sprintf(x, "%lld", a);
  string s = x;
  return s;
}
inline long long StringToInt(string a) {
  char x[100];
  long long res;
  strcpy(x, a.c_str());
  sscanf(x, "%lld", &res);
  return res;
}
inline string GetString(void) {
  char x[1000005];
  scanf("%s", x);
  string s = x;
  return s;
}
inline string uppercase(string s) {
  int n = (int)s.size();
  for (int(i) = (0); (i) < (n); ++(i))
    if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}
inline string lowercase(string s) {
  int n = (int)s.size();
  for (int(i) = (0); (i) < (n); ++(i))
    if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}
inline void OPEN(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
void sieve() {
  spf[1] = 1;
  for (int i = 2; i < 1000000; i++) spf[i] = i;
  for (int i = 4; i < 1000000; i += 2) spf[i] = 2;
  for (int i = 3; i * i < 1000000; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < 1000000; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
unordered_map<int, long long int> getFactorization(int x) {
  unordered_map<int, long long int> mp;
  while (x != 1) {
    if (mp.find(spf[x]) == mp.end()) {
      mp[spf[x]] = 1;
    } else {
      mp[spf[x]]++;
    }
    x = x / spf[x];
  }
  return mp;
}
unsigned long long int power(unsigned long long int x,
                             unsigned long long int y) {
  unsigned long long int temp;
  if (y == 0) return 1;
  temp = power(x, y / 2) % 998244353;
  if (y % 2 == 0)
    return (temp * temp) % 998244353;
  else {
    if (y > 0)
      return (x * (temp * temp) % 998244353) % 998244353;
    else
      return (temp * temp) / x;
  }
}
unsigned long long int gcd(unsigned long long int a, unsigned long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
unsigned long long int lcm(unsigned long long int a, unsigned long long int b) {
  return (a * b) / gcd(a, b);
}
class DisjSet {
  int *rank, *parent, n;

 public:
  DisjSet(int n) {
    rank = new int[n];
    parent = new int[n];
    this->n = n;
    makeset();
  }
  void makeset() {
    for (int i = 0; i < n; i++) {
      parent[i] = i;
      rank[i] = 1;
    }
  }
  int root(int x) {
    while (parent[x] != x) {
      x = parent[x];
    }
    return parent[x];
  }
  void union_(int x, int y) {
    int root_x = root(x);
    int root_y = root(y);
    if (rank[root_x] < rank[root_y]) {
      parent[root_x] = root_y;
      rank[root_y] += rank[root_x];
    } else {
      parent[root_y] = root_x;
      rank[root_x] += rank[root_y];
    }
  }
  long long int gh(vector<int> cost) {
    vector<int> fin(n);
    long long int tot = 0;
    unordered_map<int, int> mp;
    for (int i = 0; i < n; i++) {
      int p = root(i);
      if (mp.find(p) == mp.end()) {
        mp[p] = cost[i];
      } else {
        mp[i] = min(mp[i], cost[i]);
      }
    }
    for (auto i = mp.begin(); i != mp.end(); i++) {
      tot += i->second;
    }
    return tot;
  }
};
bool bo(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) {
    return a.second < b.second;
  }
  return a.first < b.first;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool rule(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
  return a.first > b.first;
}
int bn_search(vector<long long int> b, int x) {
  int l = 0, r = b.size() - 1;
  while (l != r) {
    if (l > r) {
      return -1;
    }
    int mid = (l + r) / 2;
    if (b[mid] == x) {
      return mid;
    }
    if (b[mid] < x) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  return l;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  for (int po = 0; po < t; po++) {
    int n, m;
    cin >> n;
    vector<int> x_;
    vector<vector<int> > adj(n, x_);
    for (int i = 0; i < n - 1; i++) {
      int u, v;
      cin >> u >> v;
      u--;
      v--;
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    bool truth = true;
    for (int i = 0; i < n; i++) {
      if (adj[i].size() == 2) {
        truth = false;
      }
    }
    if (truth) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
