#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
bool lss[maxn];
int legs[maxn];
vector<vector<int> > adj;
void dfs(int node, int par = -1) {
  if (adj[node].size() <= 2) {
    lss[node] = 1;
    for (int i = 0; i < (int)adj[node].size(); i++)
      if (par != adj[node][i]) dfs(adj[node][i], node);
  }
}
int main() {
  int n, u, v;
  cin >> n;
  adj.resize(n);
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < n; i++)
    if (adj[i].size() == 1) dfs(i);
  for (int nd = 0; nd < n; nd++) {
    for (int i = 0; i < adj[nd].size(); i++) {
      int to = adj[nd][i];
      if (lss[to]) legs[nd] = min(2, legs[nd] + 1);
    }
  }
  for (int nd = 0; nd < n; nd++) {
    if (!lss[nd]) {
      int cnt = 0;
      for (int i = 0; i < adj[nd].size(); i++) {
        int to = adj[nd][i];
        cnt += !lss[to] && (adj[to].size() - legs[to] > 1);
      }
      if (cnt > 2) {
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");
}
