#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5 + 5;
int n, del[MaxN];
vector<int> G[MaxN];
template <typename T>
void Exit(T msg) {
  cout << msg << endl;
  exit(0);
}
void Init() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
}
void Search(int x, int f = -1) {
  if (G[x].size() <= 2) {
    del[x] = true;
    for (int nxt : G[x])
      if (nxt != f) Search(nxt, x);
  }
}
void Main() {
  for (int i = 1; i <= n; ++i)
    if (G[i].size() == 1) Search(i);
  for (int i = 1; i <= n; ++i)
    if (G[i].size() >= 3) {
      int ndeg = 0;
      for (int nxt : G[i])
        if (!del[nxt]) ++ndeg;
      if (G[i].size() == 3 && ndeg == 1) del[i] = true;
    }
  for (int i = 1; i <= n; ++i)
    if (!del[i]) {
      int ndeg = 0;
      for (int nxt : G[i])
        if (!del[nxt]) ++ndeg;
      if (ndeg > 2) Exit("No");
    }
  Exit("Yes");
}
int main() {
  Init();
  Main();
  return 0;
}
