#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 1e5 + 7;
vector<long long> V[Maxn];
long long d[Maxn];
bool mark[Maxn];
void dfs(long long u, long long par) {
  if (V[u].size() > 2) return;
  mark[u]++;
  for (long long i = 0; i < V[u].size(); i++) {
    long long v = V[u][i];
    if (par != v) dfs(v, u);
  }
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long u, v;
    cin >> u >> v;
    V[u].push_back(v);
    V[v].push_back(u);
  }
  for (long long u = 1; u <= n; u++)
    if (V[u].size() == 1) dfs(u, -1);
  for (long long u = 1; u <= n; u++)
    for (long long i = 0; i < V[u].size(); i++) {
      long long v = V[u][i];
      if (mark[v]) d[u] = min(d[u] + 1, 2ll);
    }
  for (long long u = 1; u <= n; u++)
    if (!mark[u]) {
      long long ted = 0;
      for (long long i = 0; i < V[u].size(); i++) {
        long long v = V[u][i];
        if (!mark[v] && V[v].size() - d[v] > 1) ted++;
      }
      if (ted > 2) {
        cout << "No" << endl;
        return 0;
      }
    }
  cout << "Yes" << endl;
  return 0;
}
