#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 10;
bool mark[maxn];
int legs[maxn];
vector<int> vr[maxn];
void dfs(int v, int p = 0) {
  if (vr[v].size() <= 2) {
    mark[v] = true;
    for (int i = 0; i < vr[v].size(); i++)
      if (vr[v][i] != p) dfs(vr[v][i], v);
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int v, u;
    cin >> v >> u;
    vr[v].push_back(u);
    vr[u].push_back(v);
  }
  for (int i = 1; i <= n; i++)
    if (vr[i].size() == 1) dfs(i);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < vr[i].size(); j++)
      if (mark[vr[i][j]] == true) legs[i] = min(legs[i] + 1, 2);
  for (int i = 1; i <= n; i++)
    if (mark[i] == false) {
      int cnt = 0;
      for (int j = 0; j < vr[i].size(); j++)
        if (mark[vr[i][j]] == false &&
            vr[vr[i][j]].size() - legs[vr[i][j]] - 1 > 0)
          cnt++;
      if (cnt > 2) {
        cout << "No\n";
        return 0;
      }
    }
  cout << "Yes\n";
  return 0;
}
