#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
int n, p, q, x[maxn];
set<int> s[maxn];
bool mark[maxn], size[maxn], check = 1;
void dfs(int u) {
  if (size[u] or mark[u] or x[u] > 2) return;
  if (x[u] <= 1)
    x[*s[u].begin()]++;
  else
    mark[*s[u].begin()] = 1;
  s[*s[u].begin()].erase(u);
  if (s[*s[u].begin()].size() == 1) dfs(*s[u].begin());
  size[u] = 1;
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int fi, se;
    cin >> fi >> se;
    s[fi].insert(se);
    s[se].insert(fi);
  }
  for (int i = 1; i <= n; i++)
    if (s[i].size() == 1) dfs(i);
  for (int i = 1; i <= n; i++)
    if (!size[i] && s[i].size() > 2) check = 0;
  if (check == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
