#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 10;
int main() {
  int n;
  scanf("%d", &n);
  vector<vector<int> > gr(n);
  int deg[mx] = {};
  bool gone[mx] = {};
  for (int i = (0); i < int(n - 1); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    gr[a].push_back(b);
    gr[b].push_back(a);
    ++deg[a];
    ++deg[b];
  }
  stack<int> junk;
  for (int i = (0); i < int(n); ++i)
    if (deg[i] == 1 && deg[gr[i][0]] <= 2) junk.push(i);
  while (!junk.empty()) {
    int j = junk.top();
    junk.pop();
    gone[j] = 1;
    for (int v : gr[j])
      if (!gone[v]) {
        if (--deg[v] == 1) {
          for (int vv : gr[v])
            if (!gone[vv]) {
              if (deg[vv] <= 2) junk.push(v);
              break;
            }
        }
        break;
      }
  }
  int leafDeg[mx] = {};
  for (int i = (0); i < int(n); ++i)
    if (!gone[i] && deg[i] == 1)
      for (int v : gr[i]) ++leafDeg[v];
  for (int i = (0); i < int(n); ++i) {
    if (gone[i]) continue;
    int cnt = 0;
    for (int v : gr[i])
      if (!gone[v] && deg[v] - min(2, leafDeg[v]) > 1) ++cnt;
    if (cnt > 2) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
}
