#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
int n, a, b;
vector<int> child[100005];
vector<int> adj[100005];
bool visited[100005];
int simple[100005];
void setChild() {
  deque<int> q;
  q.push_back(1);
  visited[1] = 1;
  while (!q.empty()) {
    int t = q.front();
    q.pop_front();
    for (int i = 0; i < (int)adj[t].size(); i++) {
      int next = adj[t][i];
      if (visited[next] == 0) {
        visited[next] = t;
        child[t].push_back(next);
        q.push_back(next);
      }
    }
  }
}
bool isSimple(int idx) {
  int& ret = simple[idx];
  if (ret != -1) return ret;
  if (child[idx].size() == 0)
    return ret = 1;
  else if (child[idx].size() == 1)
    return ret = isSimple(child[idx][0]);
  else
    return ret = 0;
}
bool isPossible(int idx, int lim, int simpCnt) {
  if (child[idx].size() == 1) {
    if (simpCnt >= 2 && lim == 2) return isPossible(child[idx][0], 1, simpCnt);
    return isPossible(child[idx][0], lim, simpCnt);
  }
  int cntSimple = 0;
  bool bCSimple = 0;
  vector<int> nOnes;
  for (int i = 0; i < (int)child[idx].size(); i++) {
    int next = child[idx][i];
    bool simple = isSimple(next);
    if (!simple) {
      bool cSimple = 1;
      for (int j = 0; j < (int)child[next].size(); j++) {
        cSimple &= isSimple(child[next][j]);
        if (!cSimple) break;
      }
      if (child[next].size() == 2 && cSimple) {
        bCSimple = 1;
        continue;
      }
      nOnes.push_back(next);
      if (nOnes.size() > lim) return false;
    } else
      cntSimple++;
  }
  if (nOnes.size() == 2) {
    return isPossible(nOnes[0], 1, simpCnt) && isPossible(nOnes[1], 1, simpCnt);
  } else if (nOnes.size() == 1) {
    if (lim == 2 && cntSimple <= 2 && !bCSimple) {
      return isPossible(nOnes[0], 2, simpCnt + cntSimple);
    }
    return isPossible(nOnes[0], 1, cntSimple);
  } else
    return true;
}
int main() {
  memset(visited, 0, sizeof(visited));
  memset(simple, -1, sizeof(simple));
  scanf("%d", &n);
  for (int i = 0; i < (int)n - 1; i++) {
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  setChild();
  bool b = isPossible(1, 2, 0);
  if (b)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
