#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
vector<int> G[MAXN];
int n, leg[MAXN];
bool mark[MAXN];
void init() {
  cin >> n;
  for (int u, v, i = 1; i < n; i++) {
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
}
void dfs(int u, int f) {
  if (G[u].size() <= 2) {
    mark[u] = 1;
    for (int i = 0; i < G[u].size(); i++)
      if (G[u][i] != f) dfs(G[u][i], u);
  }
  return;
}
void solve() {
  for (int i = 1; i <= n; i++)
    if (G[i].size() == 1) dfs(i, 0);
  for (int u = 1; u <= n; u++)
    if (!mark[u])
      for (int i = 0; i < G[u].size(); i++)
        if (mark[G[u][i]]) leg[u]++;
  for (int u = 1; u <= n; u++)
    if (!mark[u]) {
      int cnt = 0;
      for (int i = 0; i < G[u].size(); i++)
        if (!mark[G[u][i]])
          if (G[G[u][i]].size() > min(leg[G[u][i]], 2) + 1) cnt++;
      if (cnt > 2) {
        cout << "No";
        return;
      }
    }
  cout << "Yes" << endl;
}
int main() {
  init();
  solve();
  return 0;
}
