#include <bits/stdc++.h>
using namespace std;
set<int> v[100003];
int a[100003], b[100003], c[100003], n;
void dfs(int x) {
  if (b[x] || c[x] || a[x] > 2) return;
  if (a[x] < 2)
    a[*v[x].begin()]++;
  else
    b[*v[x].begin()] = 1;
  v[*v[x].begin()].erase(x);
  if (v[*v[x].begin()].size() == 1) dfs(*v[x].begin());
  c[x] = 1;
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    v[a].insert(b);
    v[b].insert(a);
  }
  for (int i = 0; i < n; i++)
    if (v[i].size() == 1) dfs(i);
  for (int i = 0; i < n; i++)
    if (c[i] == 0 && v[i].size() > 2) {
      cout << "No";
      return 0;
    }
  cout << "Yes";
}
