#include <bits/stdc++.h>
using namespace std;
vector<int> g[(1 << 17)];
int n, a, b, d[(1 << 17)], l[(1 << 17)], C;
void dfs(int nd, int p) {
  if (g[nd].size() < 3) {
    d[nd] = 1;
    for (int i : g[nd])
      if (i != p) dfs(i, nd);
  }
}
int main(void) {
  scanf("%d", &n);
  for (int i(1); i < n; ++i)
    scanf("%d%d", &a, &b), g[--a].push_back(--b), g[b].push_back(a);
  for (int i(0); i < n; ++i)
    if (g[i].size() == 1) dfs(i, -1);
  for (int i(0); i < n; ++i)
    for (int j : g[i])
      if (d[j]) l[i] = min(2, l[i] + 1);
  for (int i(0), c(0); i < n; ++i, c = 0)
    if (!d[i]) {
      for (int j : g[i])
        if (!d[j] && g[j].size() - l[j] > 1) ++c;
      C |= c > 2;
    }
  printf("%s\n", C ? "No" : "Yes");
  return 0;
}
