#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100000 + 5], child[100000 + 5];
bool flag[100000 + 5];
int legs[100000 + 5];
int n, x, y;
void add(int x, int y) { adj[x].push_back(y); }
void del(int x) {
  flag[x] = 1;
  for (int i = 0; i < adj[x].size(); i++)
    if (!flag[adj[x][i]])
      if (adj[adj[x][i]].size() <= 2) del(adj[x][i]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  memset(flag, 0, sizeof(flag));
  for (int i = 1; i <= n; i++)
    if (adj[i].size() == 1) del(i);
  for (int i = 1; i <= n; i++)
    if (!flag[i]) {
      for (int j = 0; j < adj[i].size(); j++)
        if (flag[adj[i][j]]) legs[i]++;
      if (legs[i] > 2) legs[i] = 2;
    }
  bool q = true;
  for (int i = 1; i <= n; i++)
    if (!flag[i]) {
      int count = 0;
      for (int j = 0; j < adj[i].size(); j++)
        if (!flag[adj[i][j]])
          if (adj[adj[i][j]].size() - legs[adj[i][j]] > 1) count++;
      if (count > 2) {
        q = false;
        break;
      }
    }
  printf(q ? "Yes" : "No");
  return 0;
}
