#include <bits/stdc++.h>
using namespace std;
const int MAX = int(1e5);
int n;
vector<int> g[MAX];
int totalLeaves;
bool deleted[MAX] = {0};
int dfs(int v, int p = -1) {
  int nLeaves = 0;
  int nLegs = 0;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (to != p) {
      int toNLeaves = dfs(to, v);
      if (toNLeaves == 1) {
        deleted[to] = true;
        nLegs++;
      }
      nLeaves += toNLeaves;
    }
  }
  if (g[v].size() == 1) {
    nLeaves = 1;
    deleted[v] = true;
  }
  if (totalLeaves - nLeaves == 1) {
    if (p != -1) deleted[p] = true;
    nLegs++;
  }
  if (nLegs == 2 && g[v].size() == 3) deleted[v] = true;
  return nLeaves;
}
void solve() {
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int root = -1;
  for (int i = 0; i < n; i++)
    if (g[i].size() == 1) {
      totalLeaves++;
      root = i;
    }
  dfs(root);
  bool res = true;
  for (int i = 0; i < n && res; i++)
    if (!deleted[i]) {
      int neighbours = 0;
      for (int j = 0; j < g[i].size(); j++)
        if (!deleted[g[i][j]]) neighbours++;
      if (neighbours >= 3) {
        res = false;
        break;
      }
    }
  printf("%s\n", res ? "Yes" : "No");
  return;
}
void clear() {
  totalLeaves = 0;
  for (int i = 0; i < MAX; i++) {
    g[i].clear();
  }
  memset(deleted, 0, sizeof(deleted));
}
int main() {
  while (scanf("%d", &n) == 1) {
    clear();
    solve();
  }
}
