#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> graph[100009];
bool vis[100009];
int leg[100009];
void dfs(int i, int from) {
  if (graph[i].size() > 2) return;
  vis[i] = 1;
  for (int f = 0; f < graph[i].size(); f++)
    if (graph[i][f] != from) dfs(graph[i][f], i);
}
int main() {
  cin >> n;
  for (int f = 1; f < n; f++) {
    int a, b;
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int f = 1; f <= n; f++)
    if (graph[f].size() == 1) dfs(f, f);
  for (int f = 1; f <= n; f++)
    for (int f1 = 0; f1 < graph[f].size(); f1++) leg[f] += vis[graph[f][f1]];
  bool flag = 0;
  for (int f = 1; f <= n; f++) {
    int temp = 0;
    if (vis[f]) continue;
    for (int f1 = 0; f1 < graph[f].size(); f1++) {
      if (vis[graph[f][f1]]) continue;
      if (graph[graph[f][f1]].size() - min(2, leg[graph[f][f1]]) > 1) temp++;
    }
    if (temp > 2) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
}
