#include <bits/stdc++.h>
using namespace std;
int deg[100009], cnt[100009];
vector<int> e[100009];
void dfs(int u, int p, int t) {
  if (t > 0 && deg[u] > 2) {
    cnt[u]++;
    cnt[t]++;
  }
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (v == p) continue;
    if (deg[u] > 2)
      dfs(v, u, u);
    else
      dfs(v, u, t);
  }
}
int main() {
  int n, i, j, u, v;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    e[u].push_back(v);
    e[v].push_back(u);
    deg[u]++;
    deg[v]++;
  }
  dfs(1, 0, 0);
  for (i = 1; i <= n; i++) {
    if (deg[i] > 2) {
      u = 0;
      for (int j = 0; j < e[i].size(); j++) {
        v = e[i][j];
        if (deg[v] == 3 && cnt[v] == 1) u++;
      }
      if (cnt[i] > u + 2) {
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n");
  return 0;
}
