#include <bits/stdc++.h>
using namespace std;
int n, deg[100100], t[100100], legs[100100];
vector<int> adj[100100];
void dfs(int x, int px) {
  t[x] = 1;
  for (int i = 0; i < adj[x].size(); i++) {
    int u = adj[x][i];
    if (u == px) continue;
    if (deg[u] <= 2) dfs(u, x);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
    deg[x]++;
    deg[y]++;
  }
  for (int i = 1; i <= n; i++)
    if (deg[i] == 1) dfs(i, 0);
  for (int i = 1; i <= n; i++) {
    int x = adj[i].size();
    for (int j = 0; j < x; j++) {
      int v = adj[i][j];
      if (t[v]) legs[i]++;
    }
  }
  bool fl = false;
  for (int i = 1; i <= n; i++) {
    if (t[i]) continue;
    int cou = 0;
    for (int j = 0; j < adj[i].size(); j++) {
      int v = adj[i][j];
      if (!t[v] && deg[v] - min(legs[v], 2) >= 2) cou++;
      if (cou > 2) {
        fl = true;
        break;
      }
    }
  }
  if (fl)
    puts("No");
  else
    puts("Yes");
  return 0;
}
