#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
vector<int> g[MAXN];
int N;
int good[MAXN];
bool check3(int u, int fu) {
  if (good[u] != 0) {
    if (good[u] == 1)
      return true;
    else
      return false;
  }
  int size = (int)g[u].size();
  if (size == 1) {
    good[u] = 1;
    return true;
  }
  if (size > 2) {
    good[u] = -1;
    return false;
  }
  for (int i = 0; i < size; ++i) {
    int v = g[u][i];
    if (v != fu) {
      if (check3(v, u))
        good[u] = 1;
      else
        good[u] = -1;
    }
  }
  return good[u] == 1;
}
bool check2(int u, int fu) {
  int size = (int)g[u].size();
  if (size > 3) return false;
  for (int i = 0; i < size; ++i) {
    int v = g[u][i];
    if (v == fu) continue;
    if (!check3(v, u)) return false;
  }
  return true;
}
bool check1(int u, int fu) {
  vector<int> arr;
  int size = (int)g[u].size();
  for (int i = 0; i < size; ++i) {
    int v = g[u][i];
    if (v == fu) continue;
    if (!check2(v, u)) {
      arr.push_back(v);
    }
  }
  if (arr.size() > 1) return false;
  for (int i = 0; i < (int)arr.size(); ++i) {
    int v = arr[i];
    if (!check1(v, u)) return false;
  }
  return true;
}
bool check0(int root) {
  vector<int> arr;
  int size = (int)g[root].size();
  for (int i = 0; i < size; ++i) {
    int u = g[root][i];
    if (!check2(u, root)) {
      arr.push_back(u);
    }
  }
  if (arr.size() > 2) return false;
  for (int i = 0; i < (int)arr.size(); ++i) {
    int u = arr[i];
    if (!check1(u, root)) return false;
  }
  return true;
}
bool recheck(int root) {
  vector<int> arr;
  int size = (int)g[root].size();
  if (size > 3) return false;
  for (int i = 0; i < size; ++i) {
    int u = g[root][i];
    if (!check3(u, root)) arr.push_back(u);
  }
  if (arr.size() > 1) return false;
  if (arr.size() == 0) return true;
  int opposite = arr[0];
  return check0(opposite);
}
void solve() {
  scanf("%d", &N);
  for (int i = 0; i + 1 < N; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u, --v;
    g[u].push_back(v), g[v].push_back(u);
  }
  int maxDegree = 0, root = -1;
  for (int i = 0; i < N; ++i) {
    if (g[i].size() > maxDegree) {
      maxDegree = (int)g[i].size();
      root = i;
    }
  }
  if (maxDegree <= 2) {
    puts("Yes");
  } else {
    if (check0(root) || recheck(root))
      puts("Yes");
    else
      puts("No");
  }
}
int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  solve();
  return 0;
}
