#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
vector<int> ladj[N];
bool vis[N];
int arr[N];
void dfs(int u, int p) {
  if ((int)ladj[u].size() > 2) return;
  vis[u] = true;
  for (int i = 0; i < (int)ladj[u].size(); i++) {
    int v = ladj[u][i];
    if (v != p) dfs(v, u);
  }
}
bool solve() {
  int n;
  if (scanf("%d", &n) == EOF) return false;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    ladj[--x].push_back(--y);
    ladj[y].push_back(x);
  }
  for (int i = 0; i < n; i++)
    if ((int)ladj[i].size() == 1) dfs(i, -1);
  for (int i = 0; i < n; i++)
    for (int k = 0; k < (int)ladj[i].size(); k++) {
      int j = ladj[i][k];
      if (vis[j] && arr[i] < 2) arr[i]++;
    }
  for (int i = 0; i < n; i++)
    if (!vis[i]) {
      int x = 0;
      for (int k = 0; k < (int)ladj[i].size(); k++) {
        int j = ladj[i][k];
        if (!vis[j] && (int)ladj[j].size() - arr[j] > 1) x++;
      }
      if (x > 2) {
        puts("No");
        return true;
      }
    }
  puts("Yes");
  return true;
}
int main() {
  while (solve())
    ;
  return 0;
}
