#include <bits/stdc++.h>
using namespace std;
template <class T, class L>
bool smax(T &x, L y) {
  return x < y ? (x = y, 1) : 0;
}
template <class T, class L>
bool smin(T &x, L y) {
  return y < x ? (x = y, 1) : 0;
}
const int maxn = 1e5 + 17;
int n, my[maxn];
vector<int> g[maxn];
bool block[maxn];
void go_up(int v, int p = -1) {
  if (g[v].size() > 2) return;
  block[v] = 1;
  for (auto u : g[v])
    if (u != p) go_up(u, v);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (int v, u, i = 1; i < n; i++)
    cin >> v >> u, g[--v].push_back(--u), g[u].push_back(v);
  for (int i = 0; i < n; i++)
    if (g[i].size() == 1) go_up(i, -1);
  for (int v = 0; v < n; v++)
    for (auto u : g[v])
      if (block[u]) my[v]++;
  for (int v = 0; v < n; v++)
    if (!block[v]) {
      int cnt = 0;
      for (auto u : g[v]) cnt += !block[u] && g[u].size() - min(my[u], 2) > 1;
      if (cnt > 2) return cout << "No\n", 0;
    }
  cout << "Yes\n";
  return 0;
}
