#include <bits/stdc++.h>
using namespace std;
int n, root, newroot;
vector<int> v[100100];
void read() {
  int i;
  int x, y;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
}
int solve(int x, int parent) {
  int i, sz;
  int current, level1 = 0, level2 = 0, sublevel1 = 0;
  sz = v[x].size();
  for (i = 0; i < sz; i++) {
    if (v[x][i] == parent) continue;
    current = solve(v[x][i], x);
    if (current == 0) return 0;
    if (current == 1) level1++;
    if (current == 2) level2++;
    if (current == 3) sublevel1++;
  }
  if (level1 <= 1 && level2 == 0 && sublevel1 == 0) return 1;
  if (level1 <= 2 && level2 == 0 && sublevel1 == 0) return 3;
  if (level2 <= 1) return 2;
  if (x == root && level2 == 2) return 420;
  if (x != root) newroot = x;
  return 0;
}
int main() {
  int status;
  read();
  root = newroot = 1;
  status = solve(root, -1);
  if (!status) {
    root = newroot;
    status = solve(root, -1);
  }
  if (!status)
    printf("No\n");
  else
    printf("Yes\n");
}
