#include <bits/stdc++.h>
using namespace std;
const int mxn = 100006;
int n;
set<int> e[mxn];
int f[mxn];
int f3[mxn];
bool v[mxn];
void EXEC() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int L, R;
    scanf("%d%d", &L, &R);
    e[L].insert(R);
    e[R].insert(L);
  }
  for (int i = 1; i <= n; ++i) {
    f[i] = (e[i].size() >= 3);
    f3[i] = (e[i].size() == 3);
  }
  deque<int> que;
  for (int i = 1; i <= n; ++i)
    if (!f[i] && e[i].size() <= 1) que.push_back(i);
  while (!que.empty()) {
    int x = que.front();
    que.pop_front();
    v[x] = true;
    if (!e[x].empty()) {
      int y = *e[x].begin();
      e[x].erase(y);
      e[y].erase(x);
      if (!f[y] && e[y].size() <= 1) que.push_back(y);
    }
  }
  for (int i = 1; i <= n; ++i)
    if (!v[i] && f3[i] && e[i].size() <= 1) que.push_back(i);
  for (auto x : que) {
    v[x] = true;
    if (!e[x].empty()) {
      int y = *e[x].begin();
      e[x].erase(y);
      e[y].erase(x);
    }
  }
  if ([] {
        for (int i = 1; i <= n; ++i)
          if (!v[i])
            ({
              if (!(e[i].size() <= 2)) return false;
            });
        return true;
      }())
    cout << "Yes\n";
  else
    cout << "No\n";
}
int main() {
  EXEC();
  return 0;
}
