#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) {
  return (b ? gcd(b, a % b) : a);
}
inline long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
inline int cmp(double x, double y = 0, double tol = 1e-7) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
using namespace std;
const int MAXN = 1e5 + 5;
vector<int> adj[MAXN];
int y[MAXN];
int qy[MAXN];
void G(int n, int pai) {
  y[n] = 0;
  for (int i = 0; i < adj[n].size(); i++) {
    int x = adj[n][i];
    if (x != pai && adj[x].size() <= 2) G(x, n);
  }
}
int main() {
  int n, a, b, x;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 0; i < MAXN; i++) y[i] = 1;
  memset(qy, 0, sizeof qy);
  for (int i = 1; i < n + 1; i++) {
    if (adj[i].size() == 1 && y[i]) G(i, -1);
  }
  for (int i = 1; i < n + 1; i++) {
    int a = 0, b = 0;
    for (int j = 0; j < adj[i].size(); j++) {
      x = adj[i][j];
      if (y[x])
        a++;
      else
        b++;
    }
    qy[i] = a + max(b - 2, 0);
  }
  bool ans = true;
  for (int i = 1; i < n + 1; i++) {
    if (!y[i]) continue;
    int cnt = 0;
    for (int j = 0; j < adj[i].size(); j++) {
      a = adj[i][j];
      if (qy[a] > 1) cnt++;
    }
    if (cnt > 2) {
      ans = false;
      break;
    }
  }
  cout << (ans ? "Yes\n" : "No\n");
}
