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