#include <bits/stdc++.h>
template <typename T>
void xchg(T &a, T &b) {
  T c = a;
  a = b;
  b = c;
}
using namespace std;
void _main();
int main() {
  _main();
  return 0;
}
bool visited[100005];
vector<int> graph[100005];
int n, type[100005], size[100005], order[100005];
map<pair<int, int>, int> cache;
int get_type(int root, int from) {
  pair<int, int> key = make_pair(root, from);
  if (cache.count(key)) return cache[key];
  visited[root] = true;
  int i, chain_count = 0, tree_count = 0, branch_count = 0;
  for (i = 0; i < (graph[root].size()); ++i) {
    int child = graph[root][i];
    if (visited[child]) continue;
    switch (get_type(child, root)) {
      case 0:
        return cache[key] = 0;
      case 1:
        ++tree_count;
        break;
      case 2:
        ++branch_count;
        break;
      case 3:
        ++chain_count;
        break;
    }
  }
  if (tree_count > 2) {
    ;
    cout << "No" << endl;
    exit(0);
  }
  if (tree_count > 1) return cache[key] = 0;
  if (tree_count || branch_count || chain_count > 2) return cache[key] = 1;
  if (chain_count == 2) return cache[key] = 2;
  return cache[key] = 3;
}
bool attempt(int root) {
  memset((visited), 0, sizeof((visited)));
  visited[root] = true;
  int i, tree_count = 0;
  for (i = 0; i < (graph[root].size()); ++i) {
    int type = get_type(graph[root][i], root);
    if (type == 0 || (type == 1 && ++tree_count > 1)) return false;
  }
  return true;
}
bool cmp(int i, int j) { return size[i] > size[j]; }
void _main() {
  cin >> n;
  int i, a, b;
  for (i = 0; i < (n - 1); ++i) {
    order[i] = i + 1;
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  order[n - 1] = n;
  sort(order, order + n, cmp);
  for (i = 0; i < (n); ++i) {
    if (attempt(order[i])) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}
