#include <bits/stdc++.h>
using namespace std;
inline int Readint() {
  int ret = 0;
  int f = 1;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f *= -1;
  } while (ch >= 0 && (ch < '0' || ch > '9'));
  while ('0' <= ch && ch <= '9') {
    ret = ret * 10 + ch - '0';
    ch = getchar();
  }
  return ret * f;
}
void open() {
  freopen("C.in", "r", stdin);
  freopen("C.out", "w", stdout);
}
void close() {
  fclose(stdin);
  fclose(stdout);
}
const int MAXN = 1E5 + 10;
const int inf = 21;
int to[MAXN * 2], nxt[MAXN * 2];
int head[MAXN];
int tot;
int id[MAXN];
int del[MAXN];
int leg[MAXN];
int n;
void add(const int &x, const int &y) {
  tot++;
  to[tot] = y;
  nxt[tot] = head[x];
  head[x] = tot;
}
void init() {
  int x, y;
  n = Readint();
  for (int i = 2, _END_ = n; i <= _END_; i++) {
    x = Readint(), y = Readint();
    add(x, y);
    add(y, x);
    id[x]++;
    id[y]++;
  }
}
void dfs(int p, int fa) {
  if (id[p] <= 2) {
    del[p] = 1;
    for (int i = head[p]; i; i = nxt[i])
      if (to[i] != fa) dfs(to[i], p);
  }
}
int main() {
  int _ = 0;
  init();
  for (int i = 1, _END_ = n; i <= _END_; i++)
    if (id[i] == 1) dfs(i, 0);
  for (int i = 1, _END_ = n; i <= _END_; i++)
    for (int q = head[i]; q; q = nxt[q])
      if (del[to[q]]) leg[i] = min(leg[i] + 1, 2);
  int tmp;
  for (int i = 1, _END_ = n; i <= _END_; i++)
    if (!del[i]) {
      tmp = 0;
      for (int q = head[i]; q; q = nxt[q])
        if (!del[to[q]] && id[to[q]] - leg[to[q]] > 1) tmp++;
      if (tmp > 2) {
        puts("No\n");
        close();
        return 0;
      }
    }
  puts("Yes\n");
  close();
  return 0;
}
