#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
vector<int> chd[100010];
bool deleted[100010];
int legs[100010];
void dfs(int v, int p) {
  if (int((chd[v]).size()) <= 2) {
    deleted[v] = true;
    for (int to : chd[v])
      if (to != p) {
        legs[to]++;
        dfs(to, v);
      }
  }
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  for (int i = (0); i < (N - 1); ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    chd[a].push_back(b);
    chd[b].push_back(a);
  }
  for (int i = (0); i < (N); ++i)
    if (int((chd[i]).size()) == 1) dfs(i, -1);
  bool ok = true;
  for (int i = (0); i < (N); ++i) {
    if (deleted[i]) continue;
    int cnt = 0;
    for (int to : chd[i])
      if (!deleted[to] && int((chd[to]).size()) - min(legs[to], 2) > 1) ++cnt;
    if (cnt > 2) ok = false;
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}
