#include <bits/stdc++.h>
using namespace std;
int n, seen[100010], grau[100010], legs[100010];
vector<int> adj[100010];
void dfs(int u) {
  seen[u] = 1;
  int tam = adj[u].size();
  for (int i = 0; i < tam; i++) {
    int v = adj[u][i];
    if (grau[v] >= 3) {
      legs[v]++;
    } else if (!seen[v]) {
      dfs(v);
    }
  }
}
int main() {
  int a, b;
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++) {
      adj[i].clear();
    }
    memset(grau, 0, sizeof(grau));
    for (int i = 0; i < n - 1; i++) {
      scanf("%d %d", &a, &b);
      a--;
      b--;
      adj[a].push_back(b);
      adj[b].push_back(a);
      grau[a]++;
      grau[b]++;
    }
    memset(seen, 0, sizeof(seen));
    for (int i = 0; i < n; i++) {
      if (!seen[i] && grau[i] == 1) {
        dfs(i);
      }
    }
    bool ans = true;
    for (int u = 0; u < n; u++) {
      int tam = adj[u].size(), cnt = 0;
      for (int i = 0; i < tam; i++) {
        int v = adj[u][i];
        if (!seen[v] && !(grau[v] == 3 && legs[v] == 2)) {
          cnt++;
        }
      }
      if (cnt > 2) {
        ans = false;
      }
    }
    printf("%s\n", (ans) ? "Yes" : "No");
  }
  return 0;
}
