#include <bits/stdc++.h>
using namespace std;
vector<int> G[100009];
int n, del[100009], f[100009];
void dfs(int u, int fa = -1) {
  int sz = G[u].size();
  if (sz >= 3) return;
  del[u] = 1;
  for (int i = 0; i < sz; i++) {
    int v = G[u][i];
    if (v == fa) continue;
    dfs(v, u);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if ((int)G[i].size() == 1) dfs(i);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < (int)G[i].size(); j++) {
      if (del[G[i][j]]) f[i]++;
    }
    f[i] = min(f[i], 2);
  }
  for (int i = 1; i <= n; i++) {
    if (del[i]) continue;
    int cnt = 0;
    for (int j = 0; j < (int)G[i].size(); j++) {
      int v = G[i][j];
      if (del[v]) continue;
      if (G[v].size() - f[v] > 1) cnt++;
    }
    if (cnt > 2) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}
