#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxx = 1e5 + 2;
vector<int> a[maxx];
int f = 1, rt;
void dfs(int x, int fa) {
  if ((int)a[x].size() == 2 && x != rt) {
    f = 0;
    return;
  }
  for (int i = 0; i < a[x].size(); i++) {
    int t = a[x][i];
    if (t == fa) continue;
    dfs(t, x);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (a[i].size() == 1) {
      rt = i;
      break;
    }
  }
  dfs(rt, 0);
  if (f)
    puts("YES");
  else
    puts("NO");
}
