Limak is a little bear who learns to draw. People usually start with houses, fences and flowers but why would bears do it? Limak lives in the forest and he decides to draw a tree.

Recall that tree is a connected graph consisting of n vertices and n - 1 edges.

Limak chose a tree with n vertices. He has infinite strip of paper with two parallel rows of dots. Little bear wants to assign vertices of a tree to some n distinct dots on a paper so that edges would intersect only at their endpoints — drawn tree must be planar. Below you can see one of correct drawings for the first sample test.

<image>

Is it possible for Limak to draw chosen tree?

Input

The first line contains single integer n (1 ≤ n ≤ 105).

Next n - 1 lines contain description of a tree. i-th of them contains two space-separated integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi) denoting an edge between vertices ai and bi. It's guaranteed that given description forms a tree.

Output

Print "Yes" (without the quotes) if Limak can draw chosen tree. Otherwise, print "No" (without the quotes).

Examples

Input

8
1 2
1 3
1 6
6 4
6 7
6 5
7 8


Output

Yes


Input

13
1 2
1 3
1 4
2 5
2 6
2 7
3 8
3 9
3 10
4 11
4 12
4 13


Output

No
#include <bits/stdc++.h>
using namespace std;
template <typename tp>
inline void read(tp& x) {
  x = 0;
  char tmp;
  bool key = 0;
  for (tmp = getchar(); !isdigit(tmp); tmp = getchar()) key = (tmp == '-');
  for (; isdigit(tmp); tmp = getchar()) x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
const int N = 100010;
struct edge {
  int la, b;
} con[N << 1];
int tot, fir[N], n, dp[N];
void add(int from, int to) {
  con[++tot] = (edge){fir[from], to};
  fir[from] = tot;
}
void fail() {
  puts("No");
  exit(0);
}
void dfs(int pos, int fa) {
  dp[pos] = 0;
  for (int i = fir[pos]; i; i = con[i].la) {
    if (con[i].b == fa) continue;
    dfs(con[i].b, pos);
    if (dp[pos] == 0) {
      switch (dp[con[i].b]) {
        case 0:
          dp[pos] = 1;
          break;
        case 1:
          dp[pos] = 1;
          break;
        case 2:
          dp[pos] = 3;
          break;
        case 3:
          dp[pos] = 4;
          break;
        case 4:
          dp[pos] = 4;
          break;
        case 5:
          dp[pos] = 6;
          break;
        case 6:
          dp[pos] = 7;
          break;
        case 7:
          dp[pos] = 7;
          break;
        default:
          fail();
      }
    } else if (dp[pos] == 1) {
      switch (dp[con[i].b]) {
        case 0:
          dp[pos] = 2;
          break;
        case 1:
          dp[pos] = 2;
          break;
        case 2:
          dp[pos] = 3;
          break;
        case 3:
          dp[pos] = 4;
          break;
        case 4:
          dp[pos] = 4;
          break;
        case 5:
          dp[pos] = 7;
          break;
        case 6:
          dp[pos] = 8;
          break;
        case 7:
          dp[pos] = 8;
          break;
        default:
          fail();
      }
    } else if (dp[pos] == 2) {
      switch (dp[con[i].b]) {
        case 0:
          dp[pos] = 3;
          break;
        case 1:
          dp[pos] = 3;
          break;
        case 2:
          dp[pos] = 3;
          break;
        case 3:
          dp[pos] = 4;
          break;
        case 4:
          dp[pos] = 4;
          break;
        case 5:
          dp[pos] = 8;
          break;
        default:
          fail();
      }
    } else if (dp[pos] == 3) {
      switch (dp[con[i].b]) {
        case 0:
        case 1:
        case 2:
          dp[pos] = 3;
          break;
        case 3:
          dp[pos] = 4;
          break;
        case 4:
          dp[pos] = 4;
          break;
        default:
          fail();
      }
    } else if (dp[pos] == 4) {
      switch (dp[con[i].b]) {
        case 0:
        case 1:
        case 2:
          dp[pos] = 4;
          break;
        case 3:
          dp[pos] = 5;
          break;
        case 4:
          dp[pos] = 5;
          break;
        default:
          fail();
      }
    } else if (dp[pos] == 5) {
      switch (dp[con[i].b]) {
        case 0:
        case 1:
        case 2:
          dp[pos] = 5;
          break;
        default:
          fail();
      }
    } else if (dp[pos] == 6) {
      switch (dp[con[i].b]) {
        case 0:
        case 1:
          dp[pos] = 7;
          break;
        default:
          fail();
      }
    } else if (dp[pos] == 7) {
      switch (dp[con[i].b]) {
        case 0:
        case 1:
          dp[pos] = 8;
          break;
        default:
          fail();
      }
    } else if (dp[pos] == 8)
      fail();
  }
}
int main() {
  read(n);
  for (int i = 1, x, y; i < n; ++i) {
    read(x), read(y);
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  puts("Yes");
  return 0;
}
