#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, num[100005], flag[100005];
vector<int> a[100005];
void dfs(int u, int last) {
  if (a[u].size() <= 2) {
    flag[u] = 1;
    for (int i = 0; i <= a[u].size() - 1; ++i)
      if (a[u][i] != last) dfs(a[u][i], u);
  }
}
int main() {
  n = read();
  for (int i = 2; i <= n; ++i) {
    int u = read(), v = read();
    a[u].push_back(v);
    a[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i)
    if (a[i].size() == 1) dfs(i, 0);
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < a[i].size(); ++j) num[i] += flag[a[i][j]];
  for (int i = 1; i <= n; ++i)
    if (!flag[i]) {
      int cnt = 0;
      for (int j = 0; j < a[i].size(); ++j) {
        int v = a[i][j];
        if (!flag[v] && a[v].size() > min(num[v], 2) + 1) ++cnt;
      }
      if (cnt > 2) return puts("No") & 0;
    }
  puts("Yes");
}
