#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int maxn = 100000;
struct edge {
  int id, nxt;
  edge() {}
  edge(const int &_id, const int &_nxt) : id(_id), nxt(_nxt) {}
};
int st[maxn + 5], en;
edge e[(maxn << 1) + 5];
int n;
inline void add_edge(const int &first, const int &second) {
  e[en] = edge(second, st[first]), st[first] = en++;
}
inline void init() {
  memset(st, -1, sizeof st), en = 0;
  scanf("%d", &n);
  for (int i = (0), _end_ = (n - 1); i < _end_; ++i) {
    static int first, second;
    scanf("%d%d", &first, &second), --first, --second;
    add_edge(first, second);
    add_edge(second, first);
  }
}
int dp[maxn + 5], fa[maxn + 5];
int deg[maxn + 5];
int place;
void dfs(const int &first, int limit) {
  if (place != -1) return;
  int tot = 0;
  for (int i = st[first]; i != -1; i = e[i].nxt) {
    const int &second = e[i].id;
    if (second == fa[first]) continue;
    ++tot;
    fa[second] = first;
    dfs(second, 1);
    if ((limit -= dp[second]) < 0) {
      place = first;
      return;
    }
    dp[first] |= dp[second] || deg[second] >= 2;
  }
  deg[first] = tot;
  dp[first] |= tot > 2;
}
int main() {
  init();
  fa[0] = -1;
  place = -1;
  dfs(0, 2);
  if (place != -1) {
    int first = place;
    place = -1;
    memset(dp, 0, sizeof dp);
    fa[first] = -1;
    dfs(first, 2);
  }
  puts(place == -1 ? "Yes" : "No");
  return 0;
}
