#include <bits/stdc++.h>
using namespace std;
long long n, sz[100005], lg[100005];
bool del[100005];
vector<long long> e[100005];
void dfs(long long nw, long long sn) {
  if (sz[nw] <= 2) {
    del[nw] = 1;
    for (int i = 0; i < sz[nw]; i++)
      if (e[nw][i] != sn) dfs(e[nw][i], nw);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) sz[i] = e[i].size();
  for (int i = 1; i <= n; i++) {
    if (sz[i] == 1) dfs(i, 0);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < sz[i]; j++) {
      if (del[e[i][j]]) lg[i]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!del[i]) {
      long long cnt = 0;
      for (int j = 0; j < sz[i]; j++) {
        if (sz[e[i][j]] - min(lg[e[i][j]], 2ll) > 1 && (!del[i])) ++cnt;
        if (cnt > 2) return printf("No"), 0;
      }
    }
  }
  return printf("Yes"), 0;
}
