#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
bool d[100005];
int s[100005];
void del(int i, int par) {
  if (v[i].size() <= 2) {
    d[i] = true;
    for (int j : v[i])
      if (j != par) del(j, i);
  }
}
int main() {
  int n;
  cin >> n;
  int a, b;
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (v[i].size() == 1) del(i, 0);
  }
  for (int i = 1; i <= n; i++) {
    for (int j : v[i])
      if (d[j]) s[i] = min(s[i] + 1, 2);
  }
  for (int i = 1; i <= n; i++)
    if (!d[i]) {
      int cnt = 0;
      for (int j : v[i])
        if (!d[j] && v[j].size() - s[j] > 1) cnt++;
      if (cnt > 2) {
        cout << "No\n";
        return 0;
      }
    }
  cout << "Yes\n";
  return 0;
}
