#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);
const int maxn = 100000 + 10;
vector<int> G[maxn];
bool del[maxn];
int legs[maxn];
void dfs(int u, int f) {
  if (G[u].size() <= 2) {
    del[u] = true;
    for (auto v : G[u])
      if (v != f) dfs(v, u);
  }
}
int main() {
  int n, u, v;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    if (G[i].size() == 1) dfs(i, -1);
  for (int i = 1; i <= n; i++)
    if (!del[i]) {
      for (auto v : G[i])
        if (del[v]) legs[i] = min(legs[i] + 1, 2);
    }
  for (int i = 1; i <= n; i++)
    if (!del[i]) {
      int cnt = 0;
      for (auto v : G[i])
        if (!del[v] && G[v].size() - legs[v] > 1) cnt++;
      if (cnt > 2) {
        puts("No");
        return 0;
      }
    }
  puts("Yes");
  return 0;
}
